Bug 722655 - Fix crash on about:home when tab isn't present (r=mfinkle a=akeybl)
authorLucas Rocha <lucasr@mozilla.com>
Thu, 02 Feb 2012 15:49:43 +0000
changeset 88342 4e7107d35192e74612ddf7241ac897ab95eac0f4
parent 88341 53b837964a4b5fba0a13cd740cba707d6c0a3133
child 88343 2f88bdcf5fbf925c15a629f5bbc50459c7f10109
push idunknown
push userunknown
push dateunknown
reviewersmfinkle, akeybl
bugs722655
milestone12.0a2
Bug 722655 - Fix crash on about:home when tab isn't present (r=mfinkle a=akeybl)
mobile/android/base/AboutHomeContent.java
--- a/mobile/android/base/AboutHomeContent.java
+++ b/mobile/android/base/AboutHomeContent.java
@@ -527,18 +527,23 @@ public class AboutHomeContent extends Sc
         for (int i = 0; i < tabs.length(); i++) {
             final String title;
             final String url;
             try {
                 JSONObject tab = tabs.getJSONObject(i);
                 int index = tab.getInt("index");
                 JSONArray entries = tab.getJSONArray("entries");
                 JSONObject entry = entries.getJSONObject(index - 1);
-                title = entry.getString("title");
                 url = entry.getString("url");
+
+                String optTitle = entry.optString("title");
+                if (optTitle.length() == 0)
+                    title = url;
+                else
+                    title = optTitle;
             } catch (JSONException e) {
                 Log.e(LOGTAG, "error reading json file", e);
                 continue;
             }
 
             // don't show last tabs for about pages
             if (url.startsWith("about:"))
                 continue;