prevents writing empty text files

This commit is contained in:
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

View file

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