[gtk/builder-tool-fixes: 1/2] builderparser: Be more robust




commit 5c1ad88137f85caa0774a6e5e8371a4b50067ea7
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Dec 13 14:44:40 2021 -0500

    builderparser: Be more robust
    
    If a document contains no useful content,
    just say so instead of crashing.

 tools/gtk-builder-tool-simplify.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/tools/gtk-builder-tool-simplify.c b/tools/gtk-builder-tool-simplify.c
index bb8e1ebd62..635b6332fa 100644
--- a/tools/gtk-builder-tool-simplify.c
+++ b/tools/gtk-builder-tool-simplify.c
@@ -2301,6 +2301,12 @@ simplify_file (const char *filename,
       return FALSE;
     }
 
+  if (data.root == NULL)
+    {
+      g_printerr (_("Can't parse ā€œ%sā€\n"), filename);
+      return FALSE;
+    }
+
   data.builder = gtk_builder_new ();
 
   if (data.convert3to4)


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