From 7cd57b3e85f7c743cb7cf7d516533cabab51718c Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 3 Feb 2023 00:10:41 +0000 Subject: [PATCH] gdesktopappinfo: Add a missing NULL check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s possible for the startup ID to be `NULL` if one wasn’t provided in the platform data passed to `launch_uris_with_dbus()`. Passing `NULL` to `g_app_launch_context_launch_failed()` causes a critical warning. Signed-off-by: Philip Withnall --- gio/gdesktopappinfo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index 30fcb2937..1f161328a 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -3157,7 +3157,7 @@ typedef struct GDesktopAppInfo *info; /* (owned) */ GAppLaunchContext *launch_context; /* (owned) (nullable) */ GAsyncReadyCallback callback; - gchar *startup_id; /* (owned) */ + gchar *startup_id; /* (owned) (nullable) */ gpointer user_data; } LaunchUrisWithDBusData; @@ -3182,7 +3182,10 @@ launch_uris_with_dbus_signal_cb (GObject *object, if (data->launch_context) { if (g_task_had_error (G_TASK (result))) - g_app_launch_context_launch_failed (data->launch_context, data->startup_id); + { + if (data->startup_id != NULL) + g_app_launch_context_launch_failed (data->launch_context, data->startup_id); + } else { GVariant *platform_data;