catch and show exceptions thrown at importing events from a file

This commit is contained in:
tibbi
2021-04-14 20:31:04 +02:00
parent 9ce553c89f
commit d7e6ed3b8f

View File

@ -866,10 +866,14 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
return return
} }
val inputStream = contentResolver.openInputStream(uri) try {
val out = FileOutputStream(tempFile) val inputStream = contentResolver.openInputStream(uri)
inputStream!!.copyTo(out) val out = FileOutputStream(tempFile)
showImportEventsDialog(tempFile.absolutePath) inputStream!!.copyTo(out)
showImportEventsDialog(tempFile.absolutePath)
} catch (e: Exception) {
showErrorToast(e)
}
} }
else -> toast(R.string.invalid_file_format) else -> toast(R.string.invalid_file_format)
} }