aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-03-11 09:49:49 +0100
committerChristian Schneppe <christian@pix-art.de>2017-03-11 20:14:57 +0100
commit20e43e541f02bf709e5bd6f83e522c8b0b4240b5 (patch)
tree69f07d9a53b853d36e924fe988d22f76932083a4 /src/main/java/de/pixart/messenger
parentbb78f82b979b07f27478144cb11bf7fc9883e07b (diff)
catch some OOM Exceptions
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java4
-rw-r--r--src/main/java/de/pixart/messenger/services/AvatarService.java6
2 files changed, 9 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 6623aeb00..e2d7894df 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -577,6 +577,8 @@ public class FileBackend {
return null;
} catch (IOException e) {
return null;
+ } catch (OutOfMemoryError e) {
+ return null;
}
}
@@ -693,6 +695,8 @@ public class FileBackend {
return null; // happens for example on Android 6.0 if contacts permissions get revoked
} catch (FileNotFoundException e) {
return null;
+ } catch (OutOfMemoryError e) {
+ return null;
} finally {
close(is);
}
diff --git a/src/main/java/de/pixart/messenger/services/AvatarService.java b/src/main/java/de/pixart/messenger/services/AvatarService.java
index 9ba9a1ba0..15c49940f 100644
--- a/src/main/java/de/pixart/messenger/services/AvatarService.java
+++ b/src/main/java/de/pixart/messenger/services/AvatarService.java
@@ -56,7 +56,11 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatar(), size);
}
if (avatar == null && contact.getProfilePhoto() != null) {
- avatar = mXmppConnectionService.getFileBackend().cropCenterSquare(Uri.parse(contact.getProfilePhoto()), size);
+ try {
+ avatar = mXmppConnectionService.getFileBackend().cropCenterSquare(Uri.parse(contact.getProfilePhoto()), size);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
if (avatar == null) {
avatar = get(contact.getDisplayName(), size, cachedOnly);