aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-08-17 00:23:28 +0200
committerdec05eba <dec05eba@protonmail.com>2023-08-17 00:23:28 +0200
commit0c2a740f885527fc06240536549f02e796e5968b (patch)
tree42ebd3c0e44bca411b2dcb69cadc3058b95d6ef0 /src
parent5a790f5b77e364063295ea6ebc355df5091e853e (diff)
Error if thumbnail resize fails
Diffstat (limited to 'src')
-rw-r--r--src/AsyncImageLoader.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp
index d719480..0ddc10c 100644
--- a/src/AsyncImageLoader.cpp
+++ b/src/AsyncImageLoader.cpp
@@ -84,7 +84,10 @@ namespace QuickMedia {
} else {
mgl::vec2i clamped_size = clamp_to_size(image.get_size(), mgl::vec2i(resize_target_size.x, resize_target_size.y));
unsigned char *output_pixels = new unsigned char[clamped_size.x * clamped_size.y * image.get_num_channels()];
- stbir_resize_uint8(image.data(), image.get_size().x, image.get_size().y, 0, output_pixels, clamped_size.x, clamped_size.y, 0, image.get_num_channels());
+ if(!stbir_resize_uint8(image.data(), image.get_size().x, image.get_size().y, 0, output_pixels, clamped_size.x, clamped_size.y, 0, image.get_num_channels())) {
+ fprintf(stderr, "Failed to resize %s\n", thumbnail_path_resized.data.c_str());
+ _exit(1);
+ }
if(image.get_num_channels() == 4) {
if(!stbi_write_png(result_path_tmp.data.c_str(), clamped_size.x, clamped_size.y, 4, output_pixels, 0)) {