[epiphany] Add missing NULL-check when getting the WebView's URI



commit 90274a4fca5c6907f0903a991871f5fd38a621ee
Author: Mario Sanchez Prada <mario mariospr org>
Date:   Mon Dec 10 17:38:13 2012 +0100

    Add missing NULL-check when getting the WebView's URI
    
    We need to check the URI is valid before asking the WebKitFaviconDatabase
    for the associated icon, since it must happen that it's NULL even if
    priv->address is not (e.g. after a load error has occurred).

 embed/ephy-web-view.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 09d23a4..2acc8b5 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1099,9 +1099,10 @@ _ephy_web_view_update_icon (EphyWebView *view)
     if (icon_surface)
       priv->icon = ephy_pixbuf_get_from_surface_scaled (icon_surface, FAVICON_SIZE, FAVICON_SIZE);
 #else
-    priv->icon = webkit_favicon_database_try_get_favicon_pixbuf (webkit_get_favicon_database (),
-                                                                 webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view)),
-                                                                 FAVICON_SIZE, FAVICON_SIZE);
+    const char *page_uri = webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view));
+    if (page_uri)
+      priv->icon = webkit_favicon_database_try_get_favicon_pixbuf (webkit_get_favicon_database (), page_uri,
+                                                                   FAVICON_SIZE, FAVICON_SIZE);
 #endif
   }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]