trap return value of shm_buffer_get

This function Can fail to return an shm_buffer if the buffer_resource
is an EGL buffer.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2014-08-26 14:06:57 -04:00
parent 559d53bc5d
commit 78bcbfff35
1 changed files with 3 additions and 1 deletions

View File

@ -163,7 +163,9 @@ _e_comp_wl_surface_cb_attach(struct wl_client *client, struct wl_resource *resou
{
struct wl_shm_buffer *b;
b = wl_shm_buffer_get(buffer_resource);
/* trap return of shm_buffer_get as it Can fail if the buffer is not
* an shm buffer (ie: egl buffer) */
if (!(b = wl_shm_buffer_get(buffer_resource))) return;
ec->comp_data->pending.w = wl_shm_buffer_get_width(b);
ec->comp_data->pending.h = wl_shm_buffer_get_height(b);