Handle empty heads in Subpage.kt

This commit is contained in:
Username404 2021-06-20 22:03:06 +02:00
parent 70a356208d
commit 84b8275179
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 3 additions and 1 deletions

View File

@ -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
)
)
}