From 77baa70eda24be0049d09123e4b81b1f03817110 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 19 Nov 2009 09:58:43 -0600 Subject: [PATCH] =?utf8?q?Bug=C2=A0600550=20-=20(...)=20doesn't=20treat=20?= =?utf8?q?arguments=20properly?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add some additional checking to g_app_info_create_from_commandline to make it handle strange inputs more elegantly. --- gio/gdesktopappinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index 187ce4a..7770444 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -1607,6 +1607,8 @@ g_app_info_create_from_commandline (const char *commandline, char *basename; GDesktopAppInfo *info; + g_return_val_if_fail (commandline, NULL); + info = g_object_new (G_TYPE_DESKTOP_APP_INFO, NULL); info->filename = NULL; @@ -1628,7 +1630,7 @@ g_app_info_create_from_commandline (const char *commandline, { /* FIXME: this should be more robust. Maybe g_shell_parse_argv and use argv[0] */ split = g_strsplit (commandline, " ", 2); - basename = g_path_get_basename (split[0]); + basename = split[0] ? g_path_get_basename (split[0]) : NULL; g_strfreev (split); info->name = basename; if (info->name == NULL) -- 2.7.4