Add a null check to UserAvatarView.setBitmap
Adds a null check for the bitmap to set. Resets the paint's shader in case of a null bitmap to release any previous image. Change-Id: I1adf3c8ef44522a593fe3f25726b6c83120d7556
This commit is contained in:
@@ -90,8 +90,12 @@ public class UserAvatarView extends View {
|
||||
public void setBitmap(Bitmap bitmap) {
|
||||
setDrawable(null);
|
||||
mBitmap = bitmap;
|
||||
mBitmapPaint.setShader(new BitmapShader(
|
||||
bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
|
||||
if (mBitmap != null) {
|
||||
mBitmapPaint.setShader(new BitmapShader(
|
||||
bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
|
||||
} else {
|
||||
mBitmapPaint.setShader(null);
|
||||
}
|
||||
configureBounds();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user