colorselector: add safety check for NULL pointer from ecore_x_image_new().

Summary:
ecore_x_image_new() API can return NULL.
@fix

Reviewers: raster, woohyun, Hermet, cedric

Differential Revision: https://phab.enlightenment.org/D2667

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Youngbok Shin 2015-06-17 15:09:13 +02:00 committed by Cedric BAIL
parent 67b5d368b0
commit e8b50f5788
1 changed files with 7 additions and 0 deletions

View File

@ -620,6 +620,13 @@ _mouse_grab_pixels(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
scr = ecore_x_default_screen_get();
visual = ecore_x_default_visual_get(display, scr);
img = ecore_x_image_new(17, 17, visual, ecore_x_window_depth_get(sd->grab.xroot));
if (!img)
{
ERR("Failed to get an image from ecore_x_image_new()");
return EINA_TRUE;
}
ecore_x_image_get(img, sd->grab.xroot, x - 8, y - 8, 0, 0, 17, 17);
src = ecore_x_image_data_get(img, &bpl, &rows, &bpp);
if (!ecore_x_image_is_argb32_get(img))