[gtk/matthiasc/for-master: 5/25] builder-tool: Avoid a crash




commit cb018ec047cea6fd97d4d081b39bbcf6ceb3ac9e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Nov 1 10:32:13 2020 -0500

    builder-tool: Avoid a crash
    
    Be more careful about types that have been removed.
    I was getting criticals when converting ui files
    containing GtkToolbars.

 gtk/tools/gtk-builder-tool-simplify.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/tools/gtk-builder-tool-simplify.c b/gtk/tools/gtk-builder-tool-simplify.c
index f2f57d8eab..e1e92b7970 100644
--- a/gtk/tools/gtk-builder-tool-simplify.c
+++ b/gtk/tools/gtk-builder-tool-simplify.c
@@ -589,7 +589,7 @@ static gboolean
 property_is_boolean (Element      *element,
                      MyParserData *data)
 {
-  GParamSpec *pspec;
+  GParamSpec *pspec = NULL;
   const char *class_name;
   const char *property_name;
   int i;
@@ -605,7 +605,8 @@ property_is_boolean (Element      *element,
         property_name = (const char *)element->attribute_values[i];
     }
 
-  pspec = get_property_pspec (data, class_name, property_name, kind);
+  if (class_name && property_name)
+    pspec = get_property_pspec (data, class_name, property_name, kind);
   if (pspec)
     return G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_BOOLEAN;
 


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