diff --git a/app/src/main/java/be/chvp/nanoledger/data/LedgerRepository.kt b/app/src/main/java/be/chvp/nanoledger/data/LedgerRepository.kt index 8ba9484..3578ac9 100644 --- a/app/src/main/java/be/chvp/nanoledger/data/LedgerRepository.kt +++ b/app/src/main/java/be/chvp/nanoledger/data/LedgerRepository.kt @@ -49,7 +49,7 @@ class LedgerRepository context.contentResolver.openOutputStream(fileUri, "wa") ?.let { OutputStreamWriter(it) } ?.use { - if (fileContents.value!!.last() != "") { + if (!fileContents.value!!.isEmpty() && fileContents.value!!.last() != "") { it.write("\n") } it.write(text)