From ab809d1dc35f8984eb2f64cac70956eb11598576 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 12 Jul 2023 15:49:11 -0400 Subject: [PATCH] buildertool: Exit orderly 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/gtk-builder-tool-validate.c b/tools/gtk-builder-tool-validate.c index 011b8b8d79..7cd0695b19 100644 --- a/tools/gtk-builder-tool-validate.c +++ b/tools/gtk-builder-tool-validate.c @@ -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);