Bug 1399148 - Check we actually have an Editable before searching for a span. r?jwu draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Tue, 12 Sep 2017 19:20:50 +0200
changeset 663118 a234ed796566b5463e753c197bf1a0925cc87cc9
parent 663117 def99f1bfafdbe347f2929e6a5b8fcb6ad29d8bc
child 663191 42c33e6b3bc085569362558f430d6191a06cbe3f
push id79330
push usermozilla@buttercookie.de
push dateTue, 12 Sep 2017 17:23:43 +0000
reviewersjwu
bugs1399148
milestone57.0a1
Bug 1399148 - Check we actually have an Editable before searching for a span. r?jwu MozReview-Commit-ID: EiUO8wWSyLB
mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
--- a/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
@@ -438,17 +438,17 @@ public class ToolbarDisplayLayout extend
                 // on the safe side.
                 mTitleScroll.scrollTo(0, 0);
             }
             return;
         }
 
         final ForegroundColorSpan spanToCheck =
                 mTitle.isPrivateMode() ? mPrivateDomainColorSpan : mDomainColorSpan;
-        int domainEnd = text.getSpanEnd(spanToCheck);
+        final int domainEnd = text != null ? text.getSpanEnd(spanToCheck) : -1;
         if (domainEnd == -1) {
             // We're not showing a domain, just scroll to the start of the text.
             mTitleScroll.scrollTo(0, 0);
             return;
         }
 
         // If we're showing an URL that is larger than the URL bar, we want to align the end of
         // the domain part with the right side of URL bar, so as to put the focus on the base