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

Commit 04a84559 authored by Raph Levien's avatar Raph Levien
Browse files

Fix StaticLayout crash when maxLines = 0

An app setting maxLines = 0 is an edge case, but it can happen. We
had some logic that would index an array at -1 in that case. This
patch just skips the fixup of the ellipsis line break in that case.

Bug: 22353342
Change-Id: I940cf0782b319010f5aedf75b9291df4ac2976d8
parent 7d170797
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -744,7 +744,8 @@ public class StaticLayout extends Layout {
                    && (ellipsize == TextUtils.TruncateAt.END
                        || (mMaximumVisibleLineCount == 1
                                && ellipsize != TextUtils.TruncateAt.MARQUEE));
            if (remainingLineCount < breakCount && ellipsisMayBeApplied) {
            if (remainingLineCount > 0 && remainingLineCount < breakCount &&
                    ellipsisMayBeApplied) {
                // Treat the last line and overflowed lines as a single line.
                breaks[remainingLineCount - 1] = breaks[breakCount - 1];
                // Calculate width and flag.