[glade] Don't crash when popover menu children have no visible-submenu set



commit 4c46b200e3c214008abc16fb1b87ceb116dabcd4
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Thu Dec 24 12:22:50 2015 +0000

    Don't crash when popover menu children have no visible-submenu set
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759847

 plugins/gtk+/glade-gtk-popover-menu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-popover-menu.c b/plugins/gtk+/glade-gtk-popover-menu.c
index d74d25c..773d05e 100644
--- a/plugins/gtk+/glade-gtk-popover-menu.c
+++ b/plugins/gtk+/glade-gtk-popover-menu.c
@@ -126,14 +126,14 @@ get_visible_child (GtkPopoverMenu *popover, GtkWidget **visible_child)
 
   g_object_get (G_OBJECT (popover), "visible-submenu", &visible, NULL);
   children = gtk_container_get_children (GTK_CONTAINER (popover));
-  for (l = children, i = 0; l; l = l->next, i++)
+  for (l = children, i = 0; visible && l; l = l->next, i++)
     {
       GtkWidget *child = l->data;
       gchar *name;
       gboolean found;
 
       gtk_container_child_get (GTK_CONTAINER (popover), child, "submenu", &name, NULL);
-      found = !strcmp (visible, name);
+      found = name != NULL && !strcmp (visible, name);
       g_free (name);
       if (found)
         {


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