From 5bd8d6c69ded52ba9086eb94c26fbfba76a398bd Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Wed, 11 Feb 2015 18:15:50 -0800 Subject: [PATCH] Check the part stream is non-null before decoding // FREEBIE Closes #2459 --- src/org/thoughtcrime/securesms/util/BitmapUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/util/BitmapUtil.java b/src/org/thoughtcrime/securesms/util/BitmapUtil.java index 4590dd43de..0a1c1a38bb 100644 --- a/src/org/thoughtcrime/securesms/util/BitmapUtil.java +++ b/src/org/thoughtcrime/securesms/util/BitmapUtil.java @@ -80,7 +80,9 @@ public class BitmapUtil { private static Bitmap createScaledBitmap(Context context, MasterSecret masterSecret, Uri uri, int maxWidth, int maxHeight, boolean constrainedMemory) throws IOException, BitmapDecodingException { - return createScaledBitmap(PartAuthority.getPartStream(context, masterSecret, uri), + InputStream is = PartAuthority.getPartStream(context, masterSecret, uri); + if (is == null) throw new IOException("Couldn't obtain InputStream"); + return createScaledBitmap(is, PartAuthority.getPartStream(context, masterSecret, uri), PartAuthority.getPartStream(context, masterSecret, uri), maxWidth, maxHeight, constrainedMemory);