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

Commit 07d94616 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Prevent NPE in CustomTile" into rvc-dev am: c8bb1b32 am: eed6a477

Change-Id: Iec018998c54701dc60c95906beea1bd3854a929a
parents 8248bda4 eed6a477
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -327,6 +327,7 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener

        final Drawable drawableF = drawable;
        state.iconSupplier = () -> {
            if (drawableF == null) return null;
            Drawable.ConstantState cs = drawableF.getConstantState();
            if (cs != null) {
                return new DrawableIcon(cs.newDrawable());
+8 −0
Original line number Diff line number Diff line
@@ -125,4 +125,12 @@ class CustomTileTest : SysuiTestCase() {
        customTile.handleUpdateState(state, null)
        assertFalse(state.value)
    }

    @Test
    fun testNoCrashOnNullDrawable() {
        customTile.qsTile.icon = mock(Icon::class.java)
        `when`(customTile.qsTile.icon.loadDrawable(any(Context::class.java)))
                .thenReturn(null)
        customTile.handleUpdateState(customTile.newTileState(), null)
    }
}
 No newline at end of file