Bug 881780 - Make favicon and bookmark type optional in HomeContextMenuInfo (r=sriram)
authorLucas Rocha <lucasr@mozilla.com>
Fri, 14 Jun 2013 17:33:24 +0100
changeset 143406 441bc08c4d28b09e83417ddda14328f3cda379de
parent 143405 0addf6e4c687c9146b5a43d68a920bca6d213a27
child 143407 62f98d2e95087e95f49a72c61dbf35218e9116b6
push id32723
push useremorley@mozilla.com
push dateWed, 21 Aug 2013 12:10:14 +0000
treeherdermozilla-inbound@ab6bc4d9e4c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram
bugs881780
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 881780 - Make favicon and bookmark type optional in HomeContextMenuInfo (r=sriram)
mobile/android/base/home/HomeListView.java
--- a/mobile/android/base/home/HomeListView.java
+++ b/mobile/android/base/home/HomeListView.java
@@ -68,29 +68,40 @@ public class HomeListView extends ListVi
 
         public HomeContextMenuInfo(View targetView, int position, long id, Cursor cursor) {
             super(targetView, position, id);
 
             if (cursor == null) {
                 return;
             }
 
-            isFolder = (cursor.getInt(cursor.getColumnIndexOrThrow(Bookmarks.TYPE)) == Bookmarks.TYPE_FOLDER);
+            final int typeCol = cursor.getColumnIndex(Bookmarks.TYPE);
+            if (typeCol != -1) {
+                isFolder = (cursor.getInt(typeCol) == Bookmarks.TYPE_FOLDER);
+            } else {
+                isFolder = false;
+            }
 
             if (isFolder) {
                 return;
             }
 
             int keywordCol = cursor.getColumnIndex(URLColumns.KEYWORD);
             if (keywordCol != -1) {
                 keyword = cursor.getString(keywordCol);
             } else {
                 keyword = null;
             }
 
+            final int faviconCol = cursor.getColumnIndex(URLColumns.FAVICON);
+            if (faviconCol != -1) {
+                favicon = cursor.getBlob(faviconCol);
+            } else {
+                favicon = null;
+            }
+
             rowId = cursor.getInt(cursor.getColumnIndexOrThrow(Bookmarks._ID));
             url = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.URL));
             title = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.TITLE));
-            favicon = cursor.getBlob(cursor.getColumnIndexOrThrow(URLColumns.FAVICON));
             display = Combined.DISPLAY_NORMAL;
         }
     }
 }