Skip to content

Commit 7220062

Browse files
committed
catch and show exceptions thrown at changing contact photo
1 parent 52f7846 commit 7220062

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,12 @@ class EditContactActivity : ContactActivity() {
293293
var bitmap = MediaStore.Images.Media.getBitmap(contentResolver, primaryUri)
294294
if (bitmap == null) {
295295
imageUri = backupUri
296-
bitmap = MediaStore.Images.Media.getBitmap(contentResolver, backupUri) ?: return
296+
try {
297+
bitmap = MediaStore.Images.Media.getBitmap(contentResolver, backupUri) ?: return
298+
} catch (e: Exception) {
299+
showErrorToast(e)
300+
return
301+
}
297302

298303
// we might have received an URI which we have no permission to send further, so just copy the received image in a new uri (for example from Google Photos)
299304
val newFile = getCachePhoto()

0 commit comments

Comments
 (0)