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

Commit 2fba3387 authored by Gilles Debunne's avatar Gilles Debunne
Browse files

Prevent a crash when maxLines is set to 0

Bug 6642222

Using setMaxLines(0) and setMinHeight(30) causes a crash
because Layout#getLineRangeForDraw() returns a [0,0] interval
in that case.

Accessing the Direction in draw causes a NPE.

Change-Id: If50f9b554e3cdc598a721b623992e9196982838c
parent 913bf804
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -456,6 +456,7 @@ public abstract class Layout {
        final int top = Math.max(dtop, 0);
        final int bottom = Math.min(getLineTop(getLineCount()), dbottom);

        if (top >= bottom) return TextUtils.packRangeInLong(0, -1);
        return TextUtils.packRangeInLong(getLineForVertical(top), getLineForVertical(bottom));
    }