Fix stack handling on errors for the mouse grabber

This one actually uses the return value from the function (where's the
consistency?!), so the code is fixed to only pop the return value if there is
actually one.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-03-06 10:43:23 +01:00
parent b59b28f716
commit 2d8421730b
1 changed files with 4 additions and 3 deletions

View File

@ -122,10 +122,11 @@ event_handle_mousegrabber(int x, int y, uint16_t mask)
{ {
warn("Stopping mousegrabber."); warn("Stopping mousegrabber.");
luaA_mousegrabber_stop(L); luaA_mousegrabber_stop(L);
} else {
if(!lua_isboolean(L, -1) || !lua_toboolean(L, -1))
luaA_mousegrabber_stop(L);
lua_pop(L, 1); /* pop returned value */
} }
else if(!lua_isboolean(L, -1) || !lua_toboolean(L, -1))
luaA_mousegrabber_stop(L);
lua_pop(L, 1); /* pop returned value */
return true; return true;
} }
return false; return false;