gdesktopappinfo: Add checks for empty argv

There shouldn’t be any issues here with empty argv arrays since an empty
`Exec=` line is already checked for. Encode that explicitly with an
assertion.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2022-01-31 14:48:58 +00:00
parent 3ea4ba31a1
commit 11654811ef

View File

@ -1880,6 +1880,10 @@ g_desktop_app_info_load_from_keyfile (GDesktopAppInfo *info,
else else
{ {
char *t; char *t;
/* Since @exec is not an empty string, there must be at least one
* argument, so dereferencing argv[0] should return non-NULL. */
g_assert (argc > 0);
t = g_find_program_in_path (argv[0]); t = g_find_program_in_path (argv[0]);
g_strfreev (argv); g_strfreev (argv);