diff --git a/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt b/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt index 434a622..f29649e 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt @@ -73,9 +73,11 @@ class PageAdapter(private val listener: ContentAdapterListener) : } is PreTextLine -> { val lastBlock = blocks.last() - if (lastBlock is ContentBlock.Pre && !lastBlock.closed) - lastBlock.content += line.text + "\n" - else + if (lastBlock is ContentBlock.Pre && !lastBlock.closed) { + if (lastBlock.content.isNotEmpty()) + lastBlock.content += "\n" + lastBlock.content += line.text + } else { Log.e(TAG, "setLines: unexpected preformatted line") } }