catch Out Of Memory errors at opening files in the editor

This commit is contained in:
tibbi 2021-04-19 17:03:03 +02:00
parent 22b331e535
commit 260da456c1

View file

@ -204,6 +204,9 @@ class ReadTextActivity : SimpleActivity() {
} else {
try {
contentResolver.openInputStream(uri)!!.bufferedReader().use { it.readText() }
} catch (e: OutOfMemoryError) {
showErrorToast(e.toString())
return@ensureBackgroundThread
} catch (e: Exception) {
showErrorToast(e)
finish()