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
1 changed files with 8 additions and 4 deletions

View File

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