mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Improved the error message given when jpeg, TGA, and BMP images fail to decode.
This commit is contained in:
@@ -75,7 +75,12 @@ FormatHandler::DecodedImage STBHandler::decode(love::filesystem::FileData *data)
|
||||
&comp, 4);
|
||||
|
||||
if (img.data == nullptr || img.width <= 0 || img.height <= 0)
|
||||
throw love::Exception("Could not decode image with stb_image.");
|
||||
{
|
||||
const char *err = stbi_failure_reason();
|
||||
if (err == nullptr)
|
||||
err = "unknown error";
|
||||
throw love::Exception("Could not decode image with stb_image (%s).", err);
|
||||
}
|
||||
|
||||
img.size = img.width * img.height * 4;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user