Skip to content

Commit

Permalink
Fix appending to empty file
Browse files Browse the repository at this point in the history
  • Loading branch information
chvp committed Dec 30, 2023
1 parent 5126bf5 commit 4995979
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4995979

Please sign in to comment.