diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-03-11 09:49:49 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-03-11 20:14:57 +0100 |
commit | 20e43e541f02bf709e5bd6f83e522c8b0b4240b5 (patch) | |
tree | 69f07d9a53b853d36e924fe988d22f76932083a4 /src/main/java/de/pixart | |
parent | bb78f82b979b07f27478144cb11bf7fc9883e07b (diff) |
catch some OOM Exceptions
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 4 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/AvatarService.java | 6 |
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); |