Stop recycled bitmap crashes

Fixes #792
pull/1/head
McLoo 11 years ago
parent 33000582ed
commit 5e8e13ed5a

@ -13,7 +13,6 @@ import android.util.Log;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -89,7 +88,7 @@ public class BitmapUtil {
Log.w("BitmapUtil", "Scaling to max width and height: " + aspectWidth + "," + aspectHeight); Log.w("BitmapUtil", "Scaling to max width and height: " + aspectWidth + "," + aspectHeight);
Bitmap scaledThumbnail = Bitmap.createScaledBitmap(roughThumbnail, (int)aspectWidth, (int)aspectHeight, true); Bitmap scaledThumbnail = Bitmap.createScaledBitmap(roughThumbnail, (int)aspectWidth, (int)aspectHeight, true);
roughThumbnail.recycle(); if (roughThumbnail != scaledThumbnail) roughThumbnail.recycle();
return scaledThumbnail; return scaledThumbnail;
} else { } else {
return roughThumbnail; return roughThumbnail;

Loading…
Cancel
Save