client: return nil if client is not attached to a screen yet

Can happen with the "new" class signal.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-27 10:56:56 +02:00
parent 023a216f67
commit db10f783a6
1 changed files with 2 additions and 0 deletions

View File

@ -1922,6 +1922,8 @@ luaA_client_get_type(lua_State *L, client_t *c)
static int static int
luaA_client_get_screen(lua_State *L, client_t *c) luaA_client_get_screen(lua_State *L, client_t *c)
{ {
if(!c->screen)
return 0;
lua_pushnumber(L, 1 + screen_array_indexof(&globalconf.screens, c->screen)); lua_pushnumber(L, 1 + screen_array_indexof(&globalconf.screens, c->screen));
return 1; return 1;
} }