Browse Source

GetImageData() returns NULL if image size is 0

pull/1071/head
Ray 5 years ago
parent
commit
4525c897e2
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/textures.c

+ 2
- 2
src/textures.c View File

@ -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

Loading…
Cancel
Save