drawable.surface: Return nil if there is a surface
Before this commit, it would return a NULL pointer as a lightuserdata. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
8b3087dc4e
commit
43896f68ca
|
@ -124,8 +124,11 @@ drawable_set_geometry(lua_State *L, int didx, area_t geom)
|
||||||
static int
|
static int
|
||||||
luaA_drawable_get_surface(lua_State *L, drawable_t *drawable)
|
luaA_drawable_get_surface(lua_State *L, drawable_t *drawable)
|
||||||
{
|
{
|
||||||
/* Lua gets its own reference which it will have to destroy */
|
if (drawable->surface)
|
||||||
lua_pushlightuserdata(L, cairo_surface_reference(drawable->surface));
|
/* Lua gets its own reference which it will have to destroy */
|
||||||
|
lua_pushlightuserdata(L, cairo_surface_reference(drawable->surface));
|
||||||
|
else
|
||||||
|
lua_pushnil(L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue