Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc33ffee authored by tibbi's avatar tibbi
Browse files

catch exceptions thrown at getting file output stream

parent 43e2fe62
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '3.8.11'
        propVersionName = '3.8.12'
        kotlin_version = '1.2.21'
        support_libs = '27.0.2'
    }
+7 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.simplemobiletools.commons.models.SharedTheme
import com.simplemobiletools.commons.views.MyTextView
import kotlinx.android.synthetic.main.dialog_title.view.*
import java.io.File
import java.io.FileNotFoundException
import java.io.FileOutputStream
import java.io.OutputStream
import java.util.*
@@ -559,7 +560,12 @@ fun BaseSimpleActivity.getFileOutputStream(file: File, callback: (outputStream:
            }

            if (document?.exists() == true) {
                try {
                    callback(applicationContext.contentResolver.openOutputStream(document.uri))
                } catch (e: FileNotFoundException) {
                    showErrorToast(e)
                    callback(null)
                }
            } else {
                val error = String.format(getString(R.string.could_not_create_file), file.absolutePath)
                showErrorToast(error)