From 0c2a740f885527fc06240536549f02e796e5968b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 17 Aug 2023 00:23:28 +0200 Subject: Error if thumbnail resize fails --- src/AsyncImageLoader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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)) { -- cgit v1.2.3