aboutsummaryrefslogtreecommitdiff
path: root/plugins/templating/src/main/kotlin/templates/ReplaceVersionCommandHandler.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/templating/src/main/kotlin/templates/ReplaceVersionCommandHandler.kt')
-rw-r--r--plugins/templating/src/main/kotlin/templates/ReplaceVersionCommandHandler.kt11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/templating/src/main/kotlin/templates/ReplaceVersionCommandHandler.kt b/plugins/templating/src/main/kotlin/templates/ReplaceVersionCommandHandler.kt
index 02570849..8173f839 100644
--- a/plugins/templating/src/main/kotlin/templates/ReplaceVersionCommandHandler.kt
+++ b/plugins/templating/src/main/kotlin/templates/ReplaceVersionCommandHandler.kt
@@ -13,10 +13,13 @@ class ReplaceVersionCommandHandler(private val context: DokkaContext) : CommandH
override fun canHandle(command: Command): Boolean = command is ReplaceVersionsCommand
override fun handleCommandAsTag(command: Command, body: Element, input: File, output: File) {
- val position = body.elementSiblingIndex()
val parent = body.parent()
- body.remove()
- context.configuration.moduleVersion?.takeIf { it.isNotEmpty() }
- ?.let { parent.insertChildren(position, TextNode(it)) }
+ if (parent != null) {
+ val position = body.elementSiblingIndex()
+ body.remove()
+
+ context.configuration.moduleVersion?.takeIf { it.isNotEmpty() }
+ ?.let { parent.insertChildren(position, TextNode(it)) }
+ }
}
} \ No newline at end of file