mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-03 14:20:37 +08:00
SPE-2656: Fix of failed Load file in ScalableBitmap constructor.
This commit is contained in:
parent
8c4183185b
commit
e6925fd86b
@ -1035,16 +1035,16 @@ void Plater::priv::init()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this->q->Bind(EVT_UA_AVATAR_SUCCESS, [this](UserAccountSuccessEvent& evt) {
|
this->q->Bind(EVT_UA_AVATAR_SUCCESS, [this](UserAccountSuccessEvent& evt) {
|
||||||
boost::filesystem::path path = user_account->get_avatar_path(true);
|
boost::filesystem::path path = user_account->get_avatar_path(true);
|
||||||
FILE* file;
|
FILE* file;
|
||||||
file = boost::nowide::fopen(path.generic_string().c_str(), "wb");
|
file = boost::nowide::fopen(path.generic_string().c_str(), "wb");
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
BOOST_LOG_TRIVIAL(error) << "Failed to create file to store avatar picture at: " << path;
|
BOOST_LOG_TRIVIAL(error) << "Failed to create file to store avatar picture at: " << path;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fwrite(evt.data.c_str(), 1, evt.data.size(), file);
|
fwrite(evt.data.c_str(), 1, evt.data.size(), file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
this->main_frame->refresh_account_menu(true);
|
this->main_frame->refresh_account_menu(true);
|
||||||
});
|
});
|
||||||
this->q->Bind(EVT_UA_PRUSACONNECT_PRINTER_DATA_SUCCESS, [this](UserAccountSuccessEvent& evt) {
|
this->q->Bind(EVT_UA_PRUSACONNECT_PRINTER_DATA_SUCCESS, [this](UserAccountSuccessEvent& evt) {
|
||||||
this->user_account->set_current_printer_data(evt.data);
|
this->user_account->set_current_printer_data(evt.data);
|
||||||
|
@ -487,7 +487,10 @@ ScalableBitmap::ScalableBitmap(wxWindow* parent, boost::filesystem::path& icon_p
|
|||||||
const std::string ext = icon_path.extension().string();
|
const std::string ext = icon_path.extension().string();
|
||||||
|
|
||||||
if (ext == ".png" || ext == ".jpg") {
|
if (ext == ".png" || ext == ".jpg") {
|
||||||
bitmap.LoadFile(path, ext == ".png" ? wxBITMAP_TYPE_PNG : wxBITMAP_TYPE_JPEG);
|
if (!bitmap.LoadFile(path, ext == ".png" ? wxBITMAP_TYPE_PNG : wxBITMAP_TYPE_JPEG)) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "Failed to load bitmap " << path;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// check if the bitmap has a square shape
|
// check if the bitmap has a square shape
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user