Skip to content

Commit 12ce72c

Browse files
committed
REVIEWED: ExportImage()
1 parent 998a18b commit 12ce72c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/rtextures.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
422422
{
423423
Image image = { 0 };
424424

425-
// Security check for input data
425+
// Security checks for input data
426426
if ((fileData == NULL) || (dataSize == 0))
427427
{
428428
TRACELOG(LOG_WARNING, "IMAGE: Invalid file data");
@@ -650,8 +650,9 @@ bool ExportImage(Image image, const char *fileName)
650650
allocatedData = true;
651651
}
652652

653+
if (false) { 0 } // Required to attach following 'else' cases
653654
#if defined(SUPPORT_FILEFORMAT_PNG)
654-
if (IsFileExtension(fileName, ".png"))
655+
else if (IsFileExtension(fileName, ".png"))
655656
{
656657
int dataSize = 0;
657658
unsigned char *fileData = stbi_write_png_to_mem((const unsigned char *)imgData, image.width*channels, image.width, image.height, channels, &dataSize);
@@ -701,7 +702,8 @@ bool ExportImage(Image image, const char *fileName)
701702
// NOTE: It's up to the user to track image parameters
702703
result = SaveFileData(fileName, image.data, GetPixelDataSize(image.width, image.height, image.format));
703704
}
704-
705+
else TRACELOG(LOG_WARNING, "IMAGE: Export image format requested not supported");
706+
705707
if (allocatedData) RL_FREE(imgData);
706708
#endif // SUPPORT_IMAGE_EXPORT
707709

0 commit comments

Comments
 (0)