Fail JPEG import on fatal errors only.
This commit is contained in:
@@ -73,8 +73,12 @@ Error jpeg_turbo_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer,
|
||||
data.resize(width * height * tjPixelSize[tj_pixel_format]);
|
||||
|
||||
if (tj3Decompress8(tj_instance, p_buffer, p_buffer_len, data.ptrw(), 0, tj_pixel_format) < 0) {
|
||||
tj3Destroy(tj_instance);
|
||||
return ERR_FILE_CORRUPT;
|
||||
if (tj3GetErrorCode(tj_instance) == TJERR_FATAL) {
|
||||
tj3Destroy(tj_instance);
|
||||
return ERR_FILE_CORRUPT;
|
||||
} else {
|
||||
WARN_PRINT(String::utf8(tj3GetErrorStr(tj_instance)));
|
||||
}
|
||||
}
|
||||
|
||||
tj3Destroy(tj_instance);
|
||||
|
||||
Reference in New Issue
Block a user