From 9ebd6d503cc6e80383e441171d06730fce52bd9d Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 19 Aug 2015 12:24:42 +0200 Subject: [PATCH 1/2] catch package manager has died exception --- src/main/java/eu/siacs/conversations/utils/PhoneHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java index b90f06ff9..a37f60a0f 100644 --- a/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java @@ -97,7 +97,7 @@ public class PhoneHelper { if (packageName != null) { try { return context.getPackageManager().getPackageInfo(packageName, 0).versionName; - } catch (final PackageManager.NameNotFoundException e) { + } catch (final PackageManager.NameNotFoundException | RuntimeException e) { return "unknown"; } } else { From 6e1870b00acf565bb92bcb14b9c9ee8e71020bb4 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 19 Aug 2015 12:25:17 +0200 Subject: [PATCH 2/2] check if inputstream is null before cropping avatar images --- .../eu/siacs/conversations/persistance/FileBackend.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index f18266d99..00637257c 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -385,6 +385,9 @@ public class FileBackend { BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = calcSampleSize(image, size); is = mXmppConnectionService.getContentResolver().openInputStream(image); + if (is == null) { + return null; + } Bitmap input = BitmapFactory.decodeStream(is, null, options); if (input == null) { return null; @@ -411,6 +414,9 @@ public class FileBackend { BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = calcSampleSize(image,Math.max(newHeight, newWidth)); is = mXmppConnectionService.getContentResolver().openInputStream(image); + if (is == null) { + return null; + } Bitmap source = BitmapFactory.decodeStream(is, null, options); if (source == null) { return null;