diff options
| author | Ray <[email protected]> | 2020-01-15 11:22:00 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2020-01-15 11:22:00 +0100 |
| commit | 4525c897e242a0594c12afa11cf4633d3b97cb25 (patch) | |
| tree | 8978d85b1ec8d06dbda2d405e4c74aa99fb42164 /src | |
| parent | 22b771328750a5baf138b0a125ecc21df1b1b49c (diff) | |
| download | raylib-4525c897e242a0594c12afa11cf4633d3b97cb25.tar.gz raylib-4525c897e242a0594c12afa11cf4633d3b97cb25.zip | |
GetImageData() returns NULL if image size is 0
Diffstat (limited to 'src')
| -rw-r--r-- | src/textures.c | 4 |
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 |
