prevents writing empty text files

master
y20k 2020-09-16 13:41:11 +02:00
parent 371c521a85
commit 54647b223c
No known key found for this signature in database
GPG Key ID: 824D4259F41FAFF6
1 changed files with 6 additions and 2 deletions

View File

@ -438,8 +438,12 @@ object FileHelper {
/* Writes given text to file on storage */ /* Writes given text to file on storage */
private fun writeTextFile(text: String, fileUri: Uri) { private fun writeTextFile(text: String, fileUri: Uri) {
val file: File = fileUri.toFile() if (text.isNotEmpty()) {
file.writeText(text) val file: File = fileUri.toFile()
file.writeText(text)
} else {
LogHelper.w(TAG, "Writing text file $fileUri failed. Empty text string text was provided.")
}
} }