surface-actor: Prevent a dumb crash

is_argb32 can be called at any time, including times when we don't
have a texture. In that case, just assume we're ARGB32. The value
really shouldn't be important though.
This commit is contained in:
Jasper St. Pierre 2014-03-25 17:00:43 -04:00
parent d699b2409a
commit e30ed6892c

View File

@ -86,6 +86,11 @@ meta_surface_actor_wayland_is_argb32 (MetaSurfaceActor *actor)
MetaShapedTexture *stex = meta_surface_actor_get_texture (actor); MetaShapedTexture *stex = meta_surface_actor_get_texture (actor);
CoglTexture *texture = meta_shaped_texture_get_texture (stex); CoglTexture *texture = meta_shaped_texture_get_texture (stex);
/* If we don't have a texture, like during initialization, assume
* that we're ARGB32. */
if (!texture)
return TRUE;
switch (cogl_texture_get_components (texture)) switch (cogl_texture_get_components (texture))
{ {
case COGL_TEXTURE_COMPONENTS_A: case COGL_TEXTURE_COMPONENTS_A: