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

Commit b6888167 authored by Romain Guy's avatar Romain Guy
Browse files

Fixes #1872506. Prevents NPE in ListView. When the opaque property changes at...

Fixes #1872506. Prevents NPE in ListView. When the opaque property changes at runtime, it is possible to end up in a situation in which the divider's Paint instance has not been instanciated. This change simples uses a final Paint that is guaranteed to not be null.
parent 380cd96e
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ public class ListView extends AbsListView {

    // used for temporary calculations.
    private final Rect mTempRect = new Rect();
    private Paint mDividerPaint;
    private final Paint mDividerPaint = new Paint();

    // the single allocated result per list view; kinda cheesey but avoids
    // allocating these thingies too often.
@@ -2824,9 +2824,6 @@ public class ListView extends AbsListView {
        final boolean opaque = (color >>> 24) == 0xFF;
        mIsCacheColorOpaque = opaque;
        if (opaque) {
            if (mDividerPaint == null) {
                mDividerPaint = new Paint();
            }
            mDividerPaint.setColor(color);
        }
        super.setCacheColorHint(color);