mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 03:18:14 +00:00
Additional check on file open
This commit is contained in:
@@ -192,6 +192,8 @@ Image LoadImage(const char *fileName)
|
|||||||
|
|
||||||
FILE *imFile = fopen(fileName, "rb");
|
FILE *imFile = fopen(fileName, "rb");
|
||||||
|
|
||||||
|
if (imFile != NULL)
|
||||||
|
{
|
||||||
// NOTE: Using stb_image to load images (Supports: BMP, TGA, PNG, JPG, ...)
|
// NOTE: Using stb_image to load images (Supports: BMP, TGA, PNG, JPG, ...)
|
||||||
image.data = stbi_load_from_file(imFile, &imgWidth, &imgHeight, &imgBpp, 0);
|
image.data = stbi_load_from_file(imFile, &imgWidth, &imgHeight, &imgBpp, 0);
|
||||||
|
|
||||||
@@ -206,6 +208,7 @@ Image LoadImage(const char *fileName)
|
|||||||
else if (imgBpp == 3) image.format = UNCOMPRESSED_R8G8B8;
|
else if (imgBpp == 3) image.format = UNCOMPRESSED_R8G8B8;
|
||||||
else if (imgBpp == 4) image.format = UNCOMPRESSED_R8G8B8A8;
|
else if (imgBpp == 4) image.format = UNCOMPRESSED_R8G8B8A8;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#if defined(SUPPORT_FILEFORMAT_HDR)
|
#if defined(SUPPORT_FILEFORMAT_HDR)
|
||||||
else if (IsFileExtension(fileName, ".hdr"))
|
else if (IsFileExtension(fileName, ".hdr"))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user