[Xfce4-commits] <midori:master> Allow NULL uri in katze_net_get_cached_path

Christian Dywan noreply at xfce.org
Thu Dec 6 02:32:06 CET 2012


Updating branch refs/heads/master
         to fd8f02aca67988f62c0df7cc441025ed827300bc (commit)
       from 1ecd4ad38fb3395d46a27c981fc9bd9e4d951381 (commit)

commit fd8f02aca67988f62c0df7cc441025ed827300bc
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Dec 6 02:04:44 2012 +0100

    Allow NULL uri in katze_net_get_cached_path
    
    Rather than running into g_compute_checksum_for_string assertions.

 katze/katze-net.c    |    3 +++
 midori/midori-view.c |    9 +++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/katze/katze-net.c b/katze/katze-net.c
index b17e368..05841e5 100644
--- a/katze/katze-net.c
+++ b/katze/katze-net.c
@@ -88,6 +88,9 @@ katze_net_get_cached_path (KatzeNet*    net,
     gchar* cached_filename;
     gchar* cached_path;
 
+    if (uri == NULL)
+        return NULL;
+
     checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1);
     extension = g_strrstr (uri, ".");
     cached_filename = g_strdup_printf ("%s%s", checksum,
diff --git a/midori/midori-view.c b/midori/midori-view.c
index cf3dfe7..f2d70d6 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -529,15 +529,12 @@ katze_net_icon_transfer_cb (KatzeNetRequest*  request,
     if (request->data)
     {
         gchar* icon_file = katze_net_get_cached_path (NULL, view->icon_uri, "icons");
-        if ((fp = fopen (icon_file, "wb")))
+        if (icon_file && (fp = fopen (icon_file, "wb")))
         {
-            ret  = fwrite (request->data, 1, request->length, fp);
+            ret = fwrite (request->data, 1, request->length, fp);
             fclose (fp);
             if ((ret - request->length != 0))
-            {
-                g_warning ("Error writing to file %s "
-                           "in  katze_net_icon_transfer_cb()", icon_file);
-            }
+                g_warning ("Error writing to file %s in %s", icon_file, G_STRFUNC);
         }
         g_free (icon_file);
 


More information about the Xfce4-commits mailing list