Log error when image resource not found

This commit is contained in:
Noisyfox
2025-10-31 09:00:22 +08:00
parent 8c4dd9db37
commit 420ac69e5b

View File

@@ -5,6 +5,7 @@
#include <wx/sizer.h>
#include <boost/algorithm/string/replace.hpp>
#include <boost/log/trivial.hpp>
#include "GUI.hpp"
#include "GUI_App.hpp"
@@ -463,6 +464,7 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in,
if (bmp == nullptr) {
// Neither SVG nor PNG has been found, raise error
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Could not load bitmap: " << bmp_name;
throw Slic3r::RuntimeError("Could not load bitmap: " + bmp_name);
}
@@ -482,6 +484,7 @@ wxBitmap create_scaled_bitmap2(const std::string& bmp_name_in, Slic3r::GUI::Bitm
wxBitmap* bmp = cache.load_svg2(bmp_name, width, height, grayscale, false, array_new_color, resize ? em_unit(win) * 0.1f : 0.f);
if (bmp == nullptr) {
// No SVG found
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Could not load bitmap: " << bmp_name;
throw Slic3r::RuntimeError("Could not load bitmap: " + bmp_name);
}
return *bmp;