ta{g,sk}list: check dofunction return value

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-29 11:03:57 +02:00
parent 79dc1a9501
commit 84ff146083
2 changed files with 26 additions and 24 deletions

View File

@ -105,8 +105,8 @@ taglist_draw(draw_context_t *ctx, int screen, widget_node_t *w,
tag_t *tag = tags->tab[i];
luaA_tag_userdata_new(globalconf.L, tag);
luaA_dofunction(globalconf.L, data->label, 1, 1);
if(luaA_dofunction(globalconf.L, data->label, 1, 1))
{
if(lua_isstring(globalconf.L, -1))
text[i] = lua_tolstring(globalconf.L, -1, &len[i]);
@ -123,6 +123,7 @@ taglist_draw(draw_context_t *ctx, int screen, widget_node_t *w,
area_array_append(&tda->areas, area);
}
}
/* Now that we have widget width we can compute widget x coordinate */
w->area.x = widget_calculate_offset(ctx->width, w->area.width,

View File

@ -143,8 +143,8 @@ tasklist_draw(draw_context_t *ctx, int screen,
lua_pushnumber(globalconf.L, screen + 1);
/* call label function with client as argument and wait for one
* result */
luaA_dofunction(globalconf.L, d->label, 2, 1);
if(luaA_dofunction(globalconf.L, d->label, 2, 1))
{
/* If we got a string as returned value, we got something to write:
* a label. So we store it in a client_label_t structure, pushed
* into the client_label_array_t which is owned by the object. */
@ -158,6 +158,7 @@ tasklist_draw(draw_context_t *ctx, int screen,
lua_pop(globalconf.L, 1);
}
}
if(!odata->client_labels.len)
return (w->area.width = 0);