Prevent NPE in Launcher when an icon cannot be found.

Bug #2509023

Change-Id: I053c7c9a37ed4aeb4d78a9f62dfdeea09a3959aa
This commit is contained in:
Romain Guy
2010-03-15 14:44:42 -07:00
parent 552a608e3c
commit a28fd3fa7c
2 changed files with 37 additions and 24 deletions

View File

@@ -24,9 +24,17 @@ import android.graphics.ColorFilter;
class FastBitmapDrawable extends Drawable {
private Bitmap mBitmap;
private int mWidth;
private int mHeight;
FastBitmapDrawable(Bitmap b) {
mBitmap = b;
if (b != null) {
mWidth = mBitmap.getWidth();
mHeight = mBitmap.getHeight();
} else {
mWidth = mHeight = 0;
}
}
@Override
@@ -49,26 +57,32 @@ class FastBitmapDrawable extends Drawable {
@Override
public int getIntrinsicWidth() {
return mBitmap.getWidth();
return mWidth;
}
@Override
public int getIntrinsicHeight() {
return mBitmap.getHeight();
return mHeight;
}
@Override
public int getMinimumWidth() {
return mBitmap.getWidth();
return mWidth;
}
@Override
public int getMinimumHeight() {
return mBitmap.getHeight();
return mHeight;
}
public void setBitmap(Bitmap b) {
mBitmap = b;
if (b != null) {
mWidth = mBitmap.getWidth();
mHeight = mBitmap.getHeight();
} else {
mWidth = mHeight = 0;
}
}
public Bitmap getBitmap() {