Merge pull request #1034 from Elv13/fix_spawn_crash
spawn: Fix crash when called with an empty table.
This commit is contained in:
commit
4ef524d76e
8
spawn.c
8
spawn.c
|
@ -414,8 +414,12 @@ luaA_spawn(lua_State *L)
|
||||||
if(!argv || !argv[0])
|
if(!argv || !argv[0])
|
||||||
{
|
{
|
||||||
g_strfreev(argv);
|
g_strfreev(argv);
|
||||||
luaA_warn(L, "spawn: parse error: %s", error->message);
|
if (error) {
|
||||||
g_error_free(error);
|
luaA_warn(L, "spawn: parse error: %s", error->message);
|
||||||
|
g_error_free(error);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
luaA_warn(L, "spawn: There is nothing to execute");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,9 @@ local spawn = require("awful.spawn")
|
||||||
local spawns_done = 0
|
local spawns_done = 0
|
||||||
local exit_yay, exit_snd = nil, nil
|
local exit_yay, exit_snd = nil, nil
|
||||||
|
|
||||||
|
-- * Using spawn with array is already covered by the test client.
|
||||||
|
-- * spawn with startup notification is covered by test-spawn-snid.lua
|
||||||
|
|
||||||
local steps = {
|
local steps = {
|
||||||
function(count)
|
function(count)
|
||||||
if count == 1 then
|
if count == 1 then
|
||||||
|
@ -62,6 +65,17 @@ local steps = {
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
function()
|
||||||
|
-- Test empty command table
|
||||||
|
spawn{}
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
function()
|
||||||
|
-- Test empty command string
|
||||||
|
spawn("")
|
||||||
|
assert(#client.get() == 0)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
runner.run_steps(steps)
|
runner.run_steps(steps)
|
||||||
|
|
Loading…
Reference in New Issue