From c9634b9f1116e7c5afb367020ae3499548b41b6f Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Thu, 1 May 2014 14:19:33 -0700 Subject: [PATCH] Bug 1003911 - Part 1: don't try to extract null favicons from the database. r=margaret --- mobile/android/base/db/LocalBrowserDB.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/mobile/android/base/db/LocalBrowserDB.java b/mobile/android/base/db/LocalBrowserDB.java index c6e50277ad94..b79704bdeaef 100644 --- a/mobile/android/base/db/LocalBrowserDB.java +++ b/mobile/android/base/db/LocalBrowserDB.java @@ -773,7 +773,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface { try { c = cr.query(mFaviconsUriWithProfile, new String[] { Favicons.DATA }, - Favicons.URL + " = ?", + Favicons.URL + " = ? AND " + Favicons.DATA + " IS NOT NULL", new String[] { faviconURL }, null); @@ -866,18 +866,21 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface { byte[] b = null; try { c = cr.query(mThumbnailsUriWithProfile, - new String[]{Thumbnails.DATA}, - Thumbnails.URL + " = ?", - new String[]{uri}, + new String[]{ Thumbnails.DATA }, + Thumbnails.URL + " = ? AND " + Thumbnails.DATA + " IS NOT NULL", + new String[]{ uri }, null); - if (c.moveToFirst()) { - int thumbnailIndex = c.getColumnIndexOrThrow(Thumbnails.DATA); - b = c.getBlob(thumbnailIndex); + if (!c.moveToFirst()) { + return null; } + + int thumbnailIndex = c.getColumnIndexOrThrow(Thumbnails.DATA); + b = c.getBlob(thumbnailIndex); } finally { - if (c != null) + if (c != null) { c.close(); + } } return b;