[devhelp] Check if dh_link_get_uri() returns NULL



commit 4059756d6563e1d9050a393699827134f0cad6eb
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Dec 7 15:56:46 2017 +0100

    Check if dh_link_get_uri() returns NULL
    
    In dh-assistant-view it's a bit messy, if there is an early return there
    would be memory leaks I think, I haven't looked in details.
    
    The FIXME in dh-assistant-view.c is the only place where NULL is not
    checked.

 src/dh-assistant-view.c |    1 +
 src/dh-window.c         |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/dh-assistant-view.c b/src/dh-assistant-view.c
index ac688f1..2c2e21f 100644
--- a/src/dh-assistant-view.c
+++ b/src/dh-assistant-view.c
@@ -244,6 +244,7 @@ dh_assistant_view_set_link (DhAssistantView *view,
                 return TRUE;
         }
 
+        /* FIXME uri can be NULL. */
         uri = dh_link_get_uri (link);
         anchor = strrchr (uri, '#');
         if (anchor) {
diff --git a/src/dh-window.c b/src/dh-window.c
index 913eecc..3b16913 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -1192,7 +1192,8 @@ window_search_link_selected_cb (GObject  *ignored,
         view = window_get_active_web_view (window);
 
         uri = dh_link_get_uri (link);
-        webkit_web_view_load_uri (view, uri);
+        if (uri != NULL)
+                webkit_web_view_load_uri (view, uri);
         g_free (uri);
 }
 


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