buildertool: Exit orderly
authorMatthias Clasen <mclasen@redhat.com>
Wed, 12 Jul 2023 19:49:11 +0000 (15:49 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 12 Jul 2023 19:49:11 +0000 (15:49 -0400)
The validate command does need a display connection,
for better or worse. So exit in an orderly fashion
if we don't have one, instead of crashing.

Fixes: #5948
tools/gtk-builder-tool-validate.c

index 011b8b8d79f2b568aeb971e11cb60e10e62ad8a8..7cd0695b1939d0cdfbce3202ca8cdd98e0419307 100644 (file)
@@ -263,6 +263,12 @@ do_validate (int *argc, const char ***argv)
   };
   int i;
 
+  if (gdk_display_get_default () == NULL)
+    {
+      g_printerr (_("Could not initialize windowing system\n"));
+      exit (1);
+    }
+
   g_set_prgname ("gtk4-builder-tool validate");
   context = g_option_context_new (NULL);
   g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);