diff --git a/gl/cogl-texture.c b/gl/cogl-texture.c index a580a5d19..101839e59 100644 --- a/gl/cogl-texture.c +++ b/gl/cogl-texture.c @@ -1552,6 +1552,10 @@ cogl_texture_set_region (CoglHandle handle, if (format == COGL_PIXEL_FORMAT_ANY) return FALSE; + /* Shortcut out early if the image is empty */ + if (width == 0 || height == 0) + return TRUE; + /* Init source bitmap */ source_bmp.width = width; source_bmp.height = height; diff --git a/gles/cogl-texture.c b/gles/cogl-texture.c index 5673dac82..df312e486 100644 --- a/gles/cogl-texture.c +++ b/gles/cogl-texture.c @@ -1558,6 +1558,10 @@ cogl_texture_set_region (CoglHandle handle, if (format == COGL_PIXEL_FORMAT_ANY) return FALSE; + /* Shortcut out early if the image is empty */ + if (width == 0 || height == 0) + return TRUE; + /* Init source bitmap */ source_bmp.width = width; source_bmp.height = height;