buildertool: Fix a possible crash
authorMatthias Clasen <mclasen@redhat.com>
Mon, 13 Dec 2021 18:52:50 +0000 (13:52 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 13 Dec 2021 18:52:50 +0000 (13:52 -0500)
We need to call g_markup_parse_context_end_parse
to catch incomplete documents that we might not
handle well later.

tools/gtk-builder-tool-simplify.c

index dfa4eb70974734d2f0f88bc50e2231b1877e6c8e..404a38b2d7f97518f12b74009d7725c841cb3ecf 100644 (file)
@@ -2295,6 +2295,12 @@ simplify_file (const char *filename,
       return FALSE;
     }
 
+  if (!g_markup_parse_context_end_parse (context, &error))
+    {
+      g_printerr (_("Can't parse ā€œ%sā€: %s\n"), filename, error->message);
+      return FALSE;
+    }
+
   data.builder = gtk_builder_new ();
 
   if (data.convert3to4)