diff --git a/mobile/android/base/db/LocalBrowserDB.java b/mobile/android/base/db/LocalBrowserDB.java index dfccf1480e96..aa5868962282 100644 --- a/mobile/android/base/db/LocalBrowserDB.java +++ b/mobile/android/base/db/LocalBrowserDB.java @@ -1001,6 +1001,7 @@ public class LocalBrowserDB { new String[] { faviconURL }, null); + boolean shouldDelete = false; byte[] b = null; try { if (!c.moveToFirst()) { @@ -1008,11 +1009,28 @@ public class LocalBrowserDB { } final int faviconIndex = c.getColumnIndexOrThrow(Favicons.DATA); - b = c.getBlob(faviconIndex); + try { + b = c.getBlob(faviconIndex); + } catch (IllegalStateException e) { + // This happens when the blob is more than 1MB: Bug 1106347. + // Delete that row. + shouldDelete = true; + } } finally { c.close(); } + if (shouldDelete) { + try { + Log.d(LOGTAG, "Deleting invalid favicon."); + cr.delete(mFaviconsUriWithProfile, + Favicons.URL + " = ?", + new String[] { faviconURL }); + } catch (Exception e) { + // Do nothing. + } + } + if (b == null) { return null; }