Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b325ce82 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

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
parent 5ff885cd
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -90,8 +90,12 @@ public class UserAvatarView extends View {
    public void setBitmap(Bitmap bitmap) {
        setDrawable(null);
        mBitmap = bitmap;
        if (mBitmap != null) {
            mBitmapPaint.setShader(new BitmapShader(
                    bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
        } else {
            mBitmapPaint.setShader(null);
        }
        configureBounds();
        invalidate();
    }