aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-08-26 14:54:45 +0200
committerChristian Schneppe <christian@pix-art.de>2018-08-26 14:54:45 +0200
commitdbee1d4f49a60db94b21586bd22cdf7213d17c3b (patch)
tree6cfd5b1129cf97a1e6f604e64b076f4f1a5d5570
parentad809c5d56d9b70d7577ffdd3dbcabaedc120fc8 (diff)
try to catch out of memory exception
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 3bb1e5c4e..6b35219e4 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -641,11 +641,12 @@ public class FileBackend {
bitmap = BitmapFactory.decodeStream(mXmppConnectionService.getContentResolver().openInputStream(uri));
return getPepAvatar(bitmap, Bitmap.CompressFormat.PNG, 100);
} catch (Exception e) {
+ return null;
+ } finally {
if (bitmap != null) {
bitmap.recycle();
}
}
- return null;
}
private Avatar getPepAvatar(Bitmap bitmap, Bitmap.CompressFormat format, int quality) {
@@ -679,6 +680,9 @@ public class FileBackend {
avatar.width = bitmap.getWidth();
avatar.height = bitmap.getHeight();
return avatar;
+ } catch (OutOfMemoryError e) {
+ Log.d(Config.LOGTAG, "unable to convert avatar to base64 due to low memory");
+ return null;
} catch (Exception e) {
return null;
}