From 867b499eab70315adcf42d7962d0ef1e8e22c380 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 4 Jul 2018 21:46:46 +0200 Subject: [PATCH] adding a crashfix at storing contact photo --- .../com/simplemobiletools/contacts/helpers/DBHelper.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/DBHelper.kt index 63690935..0cdd81ae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/DBHelper.kt @@ -290,7 +290,11 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont val photoByteArray = cursor.getBlobValue(COL_PHOTO) ?: null val photo = if (photoByteArray?.isNotEmpty() == true) { - BitmapFactory.decodeByteArray(photoByteArray, 0, photoByteArray.size) + try { + BitmapFactory.decodeByteArray(photoByteArray, 0, photoByteArray.size) + } catch (e: OutOfMemoryError) { + null + } } else { null }