client: Fix a potential crash due to a race condition. (#1055)

If raise was called from the awful.rule `manage` callback at
startup with a client already present it crashed due to a
buffer underflow.
This commit is contained in:
Emmanuel Lepage Vallée 2016-08-30 06:59:45 -04:00 committed by Daniel Hahler
parent f0f31bc305
commit 08e4c304cd
1 changed files with 4 additions and 1 deletions

View File

@ -2383,7 +2383,10 @@ luaA_client_raise(lua_State *L)
client_t *c = luaA_checkudata(L, 1, &client_class); client_t *c = luaA_checkudata(L, 1, &client_class);
/* Avoid sending the signal if nothing was done */ /* Avoid sending the signal if nothing was done */
if (c->transient_for == NULL && globalconf.stack.tab[globalconf.stack.len-1] == c) if (c->transient_for == NULL &&
globalconf.stack.len &&
globalconf.stack.tab[globalconf.stack.len-1] == c
)
return 0; return 0;
client_raise(c); client_raise(c);