spawn: Don't try to spawn with empty argv (FS#1225)

When e.g. calling awesome.spawn({}), our argv array would be empty, so just a
pointer to a NULL pointer that marks the end of the array.

Since startup notification was enabled, this would then try to figure out the
name of the started binary. This would immediately dereference a NULL pointer
and crash.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-03-12 11:10:48 +01:00
parent b965adc33f
commit 800a9a41f6
1 changed files with 4 additions and 1 deletions

View File

@ -321,8 +321,11 @@ luaA_spawn(lua_State *L)
use_sn = luaA_checkboolean(L, 2);
argv = parse_command(L, 1);
if(!argv)
if(!argv || !argv[0])
{
g_strfreev(argv);
return 0;
}
SnLauncherContext *context = NULL;
if(use_sn)