From 84b8275179e03348501ac979ceec6e09b14600e9 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sun, 20 Jun 2021 22:03:06 +0200 Subject: [PATCH] Handle empty heads in Subpage.kt --- src/main/kotlin/fr/username404/website/subpages/Subpage.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/fr/username404/website/subpages/Subpage.kt b/src/main/kotlin/fr/username404/website/subpages/Subpage.kt index 2f31185..313a895 100644 --- a/src/main/kotlin/fr/username404/website/subpages/Subpage.kt +++ b/src/main/kotlin/fr/username404/website/subpages/Subpage.kt @@ -14,6 +14,8 @@ data class Subpage( ) { fun open(): Document = window.document.open( type = "text/html", - replace = head.map { it.innerHTML }.reduce { previous, current -> previous + "\n" + current } + replace = (head.map { it.innerHTML }.reduceOrNull { previous, current -> previous + '\n' + current } ?: "").plus( + '\n' + content.innerHTML + ) ) }