catch and show exceptions thrown at adding message attachments

This commit is contained in:
tibbi 2020-05-30 17:20:29 +02:00
parent 1adba70f3b
commit 09892e0078
1 changed files with 7 additions and 3 deletions

View File

@ -514,9 +514,13 @@ class ThreadActivity : SimpleActivity() {
if (attachmentUris.isNotEmpty()) { if (attachmentUris.isNotEmpty()) {
for (uri in attachmentUris) { for (uri in attachmentUris) {
try {
val byteArray = contentResolver.openInputStream(uri)?.readBytes() ?: continue val byteArray = contentResolver.openInputStream(uri)?.readBytes() ?: continue
val mimeType = contentResolver.getType(uri) ?: continue val mimeType = contentResolver.getType(uri) ?: continue
message.addMedia(byteArray, mimeType) message.addMedia(byteArray, mimeType)
} catch (e: Exception) {
showErrorToast(e)
}
} }
} }