adding some crashfixes

This commit is contained in:
tibbi 2020-11-28 22:44:21 +01:00
parent 521731ec2c
commit 64011e1083
2 changed files with 9 additions and 1 deletions

View File

@ -588,6 +588,8 @@ class ThreadActivity : SimpleActivity() {
message.addMedia(byteArray, mimeType) message.addMedia(byteArray, mimeType)
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)
} catch (e: Error) {
toast(e.localizedMessage ?: getString(R.string.unknown_error_occurred))
} }
} }
} }
@ -601,6 +603,8 @@ class ThreadActivity : SimpleActivity() {
thread_attachments_wrapper.removeAllViews() thread_attachments_wrapper.removeAllViews()
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)
} catch (e: Error) {
toast(e.localizedMessage ?: getString(R.string.unknown_error_occurred))
} }
} }

View File

@ -491,7 +491,11 @@ fun Context.deleteMessage(id: Int, isMMS: Boolean) {
val uri = if (isMMS) Mms.CONTENT_URI else Sms.CONTENT_URI val uri = if (isMMS) Mms.CONTENT_URI else Sms.CONTENT_URI
val selection = "${Sms._ID} = ?" val selection = "${Sms._ID} = ?"
val selectionArgs = arrayOf(id.toString()) val selectionArgs = arrayOf(id.toString())
contentResolver.delete(uri, selection, selectionArgs) try {
contentResolver.delete(uri, selection, selectionArgs)
} catch (e: Exception) {
showErrorToast(e)
}
} }
fun Context.markMessageRead(id: Int, isMMS: Boolean) { fun Context.markMessageRead(id: Int, isMMS: Boolean) {