mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
adding a crashfix at storing contact photo
This commit is contained in:
@ -290,7 +290,11 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||||||
|
|
||||||
val photoByteArray = cursor.getBlobValue(COL_PHOTO) ?: null
|
val photoByteArray = cursor.getBlobValue(COL_PHOTO) ?: null
|
||||||
val photo = if (photoByteArray?.isNotEmpty() == true) {
|
val photo = if (photoByteArray?.isNotEmpty() == true) {
|
||||||
|
try {
|
||||||
BitmapFactory.decodeByteArray(photoByteArray, 0, photoByteArray.size)
|
BitmapFactory.decodeByteArray(photoByteArray, 0, photoByteArray.size)
|
||||||
|
} catch (e: OutOfMemoryError) {
|
||||||
|
null
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user