catching an exception thrown at creating file outputstream
This commit is contained in:
parent
e9c00d186d
commit
8c07c451bd
2 changed files with 8 additions and 3 deletions
|
@ -7,7 +7,7 @@ buildscript {
|
|||
propMinSdkVersion = 21
|
||||
propTargetSdkVersion = propCompileSdkVersion
|
||||
propVersionCode = 1
|
||||
propVersionName = '5.20.13'
|
||||
propVersionName = '5.21.0'
|
||||
kotlin_version = '1.3.61'
|
||||
}
|
||||
|
||||
|
|
|
@ -702,8 +702,13 @@ fun BaseSimpleActivity.getFileOutputStreamSync(path: String, mimeType: String, p
|
|||
return null
|
||||
}
|
||||
|
||||
val newDocument = documentFile.createFile(mimeType, path.getFilenameFromPath())
|
||||
applicationContext.contentResolver.openOutputStream(newDocument!!.uri)
|
||||
try {
|
||||
val newDocument = documentFile.createFile(mimeType, path.getFilenameFromPath())
|
||||
applicationContext.contentResolver.openOutputStream(newDocument!!.uri)
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
null
|
||||
}
|
||||
} else {
|
||||
if (targetFile.parentFile?.exists() == false) {
|
||||
targetFile.parentFile.mkdirs()
|
||||
|
|
Loading…
Reference in a new issue