Bug 868342 - (Part 3) Check for null URL in BrowserToolbar.setTitle. r=wesj
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 14 May 2013 16:19:35 -0700
changeset 143435 5991b3688770ee14dad65c0acdf5389f7d75da91
parent 143434 e1290fb9b72ebbf6e64013e2bc0f83d0df215d0d
child 143436 5f45f5f6cc29783bee64fba02bf5e45f025fa00a
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs868342
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 868342 - (Part 3) Check for null URL in BrowserToolbar.setTitle. r=wesj
mobile/android/base/BrowserToolbar.java
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -908,19 +908,20 @@ public class BrowserToolbar implements T
 
             // Setting a null title will ensure we just see the "Enter Search or Address"
             // placeholder text. Because "about:home" and "about:privatebrowsing" don't
             // have titles, their display titles will always match their URLs.
             if ("about:home".equals(title) || "about:privatebrowsing".equals(title)) {
                 title = null;
             }
 
-            if (mShowUrl && title != null) {
-                title = StringUtils.stripScheme(tab.getURL());
-                title = StringUtils.stripCommonSubdomains(title.toString());
+            String url = tab.getURL();
+            if (mShowUrl && title != null && url != null) {
+                url = StringUtils.stripScheme(url);
+                title = StringUtils.stripCommonSubdomains(url);
 
                 // highlight the domain name if we find one
                 String baseDomain = tab.getBaseDomain();
                 if (!TextUtils.isEmpty(baseDomain)) {
                     SpannableStringBuilder builder = new SpannableStringBuilder(title);
                     int index = title.toString().indexOf(baseDomain);
                     if (index > -1) {
                         builder.setSpan(mUrlColor, 0, title.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);