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

Commit d45a3355 authored by Sonia Serafimova's avatar Sonia Serafimova Committed by Jean-Baptiste Queru
Browse files

Prevent unhandled exception in NinePatchDrawable

Added null check in computeBitmapSize() to avoid unhandled
exception "java.lang.NullPointerException" at
android.graphics.Rect.<init>(Rect.java:72).

This problem was discovered in the wild.

Change-Id: I9d40629a052f1390e1811288af6209d8cc3f679b
parent beabe75a
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ public class NinePatchDrawable extends Drawable {
                    sdensity, tdensity);
            mBitmapHeight = Bitmap.scaleFromDensity(mNinePatch.getHeight(),
                    sdensity, tdensity);
            if (mNinePatchState.mPadding != null && mPadding != null) {
                Rect dest = mPadding;
                Rect src = mNinePatchState.mPadding;
                if (dest == src) {
@@ -175,6 +176,7 @@ public class NinePatchDrawable extends Drawable {
                dest.bottom = Bitmap.scaleFromDensity(src.bottom, sdensity, tdensity);
            }
        }
    }
    
    // overrides