mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
Bug 600550 - (...) doesn't treat arguments properly
Add some additional checking to g_app_info_create_from_commandline to make it handle strange inputs more elegantly.
This commit is contained in:
parent
3257e8ebe4
commit
77baa70eda
@ -1607,6 +1607,8 @@ g_app_info_create_from_commandline (const char *commandline,
|
|||||||
char *basename;
|
char *basename;
|
||||||
GDesktopAppInfo *info;
|
GDesktopAppInfo *info;
|
||||||
|
|
||||||
|
g_return_val_if_fail (commandline, NULL);
|
||||||
|
|
||||||
info = g_object_new (G_TYPE_DESKTOP_APP_INFO, NULL);
|
info = g_object_new (G_TYPE_DESKTOP_APP_INFO, NULL);
|
||||||
|
|
||||||
info->filename = 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] */
|
/* FIXME: this should be more robust. Maybe g_shell_parse_argv and use argv[0] */
|
||||||
split = g_strsplit (commandline, " ", 2);
|
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);
|
g_strfreev (split);
|
||||||
info->name = basename;
|
info->name = basename;
|
||||||
if (info->name == NULL)
|
if (info->name == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user