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

Commit 67d54ac0 authored by Gilles Debunne's avatar Gilles Debunne Committed by Android (Google) Code Review
Browse files

Merge "NPE in GMail / TextLine" into ics-mr1

parents c9295b20 fc997b4f
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -886,7 +886,7 @@ class TextLine {
                spanFlags = new int[length];
            }

            int count = 0;
            numberOfSpans = 0;
            for (int i = 0; i < length; i++) {
                final E span = allSpans[i];

@@ -896,14 +896,13 @@ class TextLine {

                final int spanFlag = spanned.getSpanFlags(span);

                spans[i] = span;
                spanStarts[i] = spanStart;
                spanEnds[i] = spanEnd;
                spanFlags[i] = spanFlag;
                spans[numberOfSpans] = span;
                spanStarts[numberOfSpans] = spanStart;
                spanEnds[numberOfSpans] = spanEnd;
                spanFlags[numberOfSpans] = spanFlag;

                count++;
                numberOfSpans++;
            }
            numberOfSpans = count;
        }

        public boolean hasSpansIntersecting(int start, int end) {
@@ -926,6 +925,7 @@ class TextLine {
        }

        public void recycle() {
            // The spans array is guaranteed to be not null when numberOfSpans is > 0
            for (int i = 0; i < numberOfSpans; i++) {
                spans[i] = null; // prevent a leak: no reference kept when TextLine is recycled
            }