From 190a1d01ee85f6eba0e34cd99545d5b2b86737c6 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Tue, 25 Feb 2014 21:17:09 -0500 Subject: [PATCH] check and report errors in launch_browser Just in case issues like #141 pop up again, lets have more debugging and error reporting. --- termite.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/termite.cc b/termite.cc index 4124a64..8873fff 100644 --- a/termite.cc +++ b/termite.cc @@ -132,7 +132,19 @@ static std::function reload_config; void launch_browser(char *browser, char *url) { char *browser_cmd[3] = {browser, url, nullptr}; - g_spawn_async(nullptr, browser_cmd, nullptr, G_SPAWN_SEARCH_PATH, nullptr, nullptr, nullptr, nullptr); + GError *error = nullptr; + + if (!browser) { + g_printerr("Browser not set, can't open url\n"); + return; + } + + g_spawn_async(nullptr, browser_cmd, nullptr, G_SPAWN_SEARCH_PATH, + nullptr, nullptr, nullptr, &error); + if (error) { + g_printerr("Error launching %s %s\n", browser, url); + g_error_free(error); + } } static void set_size_hints(GtkWindow *window, int char_width, int char_height) {