summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2020-01-15 11:22:00 +0100
committerRay <[email protected]>2020-01-15 11:22:00 +0100
commit4525c897e242a0594c12afa11cf4633d3b97cb25 (patch)
tree8978d85b1ec8d06dbda2d405e4c74aa99fb42164 /src
parent22b771328750a5baf138b0a125ecc21df1b1b49c (diff)
downloadraylib-4525c897e242a0594c12afa11cf4633d3b97cb25.tar.gz
raylib-4525c897e242a0594c12afa11cf4633d3b97cb25.zip
GetImageData() returns NULL if image size is 0
Diffstat (limited to 'src')
-rw-r--r--src/textures.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/textures.c b/src/textures.c
index 85063830..768e1be6 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -457,9 +457,9 @@ void UnloadRenderTexture(RenderTexture2D target)
// Get pixel data from image in the form of Color struct array
Color *GetImageData(Image image)
{
+ if ((image.width == 0) || (image.height == 0)) return NULL;
+
Color *pixels = (Color *)RL_MALLOC(image.width*image.height*sizeof(Color));
-
- if (pixels == NULL) return pixels;
if (image.format >= COMPRESSED_DXT1_RGB) TraceLog(LOG_WARNING, "Pixel data retrieval not supported for compressed image formats");
else