From ffa93cd12537ed64b24233889517fb13cba50d45 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Tue, 13 Dec 2011 13:59:37 +0000 Subject: [PATCH] Bug 707732 - Handle case of updating favicon on non-existing URL (r=blassey, a=mfinkle) --- mobile/android/base/db/AndroidBrowserDB.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mobile/android/base/db/AndroidBrowserDB.java b/mobile/android/base/db/AndroidBrowserDB.java index 166bd17c753..2a0581c4a0a 100644 --- a/mobile/android/base/db/AndroidBrowserDB.java +++ b/mobile/android/base/db/AndroidBrowserDB.java @@ -269,10 +269,13 @@ public class AndroidBrowserDB implements BrowserDB.BrowserDBIface { values.put(Browser.BookmarkColumns.FAVICON, stream.toByteArray()); values.put(Browser.BookmarkColumns.URL, uri); - cr.update(Browser.BOOKMARKS_URI, - values, - Browser.BookmarkColumns.URL + " = ?", - new String[] { uri }); + int updated = cr.update(Browser.BOOKMARKS_URI, + values, + Browser.BookmarkColumns.URL + " = ?", + new String[] { uri }); + + if (updated == 0) + cr.insert(Browser.BOOKMARKS_URI, values); } public void updateThumbnailForUrl(ContentResolver cr, String uri,