Bug 1080016 - Display favicons properly after interrupted page loads, r=ckitching
authorMark Capella <markcapella@twcny.rr.com>
Wed, 08 Oct 2014 20:41:15 -0400
changeset 209664 800257dc7f64820b78b5261936a7526afba5e679
parent 209663 cb23299c13c744bae7bd2812f90c8348b1c73710
child 209665 2de38d7048555446e6188df57080ae9abcb9dbd6
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersckitching
bugs1080016
milestone35.0a1
Bug 1080016 - Display favicons properly after interrupted page loads, r=ckitching
mobile/android/base/db/LocalBrowserDB.java
--- a/mobile/android/base/db/LocalBrowserDB.java
+++ b/mobile/android/base/db/LocalBrowserDB.java
@@ -1008,17 +1008,24 @@ public class LocalBrowserDB {
         Cursor c = cr.query(mHistoryUriWithProfile,
                             new String[] { History.FAVICON_URL },
                             Combined.URL + " = ?",
                             new String[] { uri },
                             null);
 
         try {
             if (c.moveToFirst()) {
-                return c.getString(c.getColumnIndexOrThrow(History.FAVICON_URL));
+                // Interrupted page loads can leave History items without a valid favicon_id.
+                final int columnIndex = c.getColumnIndexOrThrow(History.FAVICON_URL);
+                if (!c.isNull(columnIndex)) {
+                    final String faviconURL = c.getString(columnIndex);
+                    if (faviconURL != null) {
+                        return faviconURL;
+                    }
+                }
             }
         } finally {
             c.close();
         }
 
         // If that fails, check in the bookmarks table.
         c = cr.query(mBookmarksUriWithProfile,
                      new String[] { Bookmarks.FAVICON_URL },