mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
catch and show exceptions thrown at adding message attachments
This commit is contained in:
@ -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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user