Never resize a Bitmap down to 0 at load time
Bug #8313929
Change-Id: Ic9b691319f162228c72ad1afed4dfe0b4181c422
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 905dc8e..ee768e6 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -566,8 +566,9 @@
float scale = targetDensity / (float) density;
if (scale != 1.0f) {
final Bitmap oldBitmap = bm;
- bm = Bitmap.createScaledBitmap(oldBitmap, (int) (bm.getWidth() * scale + 0.5f),
- (int) (bm.getHeight() * scale + 0.5f), true);
+ bm = Bitmap.createScaledBitmap(oldBitmap,
+ Math.max(1, (int) (bm.getWidth() * scale + 0.5f)),
+ Math.max(1, (int) (bm.getHeight() * scale + 0.5f)), true);
if (bm != oldBitmap) oldBitmap.recycle();
if (isNinePatch) {