mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-12 06:18:14 +00:00
GetImageData() returns NULL if image size is 0
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user