From 5e8e13ed5a897c4a91e82fac81f70b4ea4e224ca Mon Sep 17 00:00:00 2001 From: McLoo Date: Thu, 3 Apr 2014 22:10:56 +0200 Subject: [PATCH] Stop recycled bitmap crashes Fixes #792 --- src/org/thoughtcrime/securesms/util/BitmapUtil.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/util/BitmapUtil.java b/src/org/thoughtcrime/securesms/util/BitmapUtil.java index 3c76ffb85c..9c5646dca4 100644 --- a/src/org/thoughtcrime/securesms/util/BitmapUtil.java +++ b/src/org/thoughtcrime/securesms/util/BitmapUtil.java @@ -13,7 +13,6 @@ import android.util.Log; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -89,7 +88,7 @@ public class BitmapUtil { Log.w("BitmapUtil", "Scaling to max width and height: " + aspectWidth + "," + aspectHeight); Bitmap scaledThumbnail = Bitmap.createScaledBitmap(roughThumbnail, (int)aspectWidth, (int)aspectHeight, true); - roughThumbnail.recycle(); + if (roughThumbnail != scaledThumbnail) roughThumbnail.recycle(); return scaledThumbnail; } else { return roughThumbnail;