Skip to content

Commit a7adeb6

Browse files
authored
Fix crash on printer error when stealth mode is enabled (OrcaSlicer#11225)
Fix crash on printer error when stealth mode is enabled (OrcaSlicer#11203)
1 parent 4501bf6 commit a7adeb6

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/slic3r/GUI/GUI_App.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,7 @@ void GUI_App::post_init()
953953
}
954954
#endif
955955

956-
if (!app_config->get_stealth_mode())
957-
hms_query = new HMSQuery();
956+
hms_query = new HMSQuery();
958957

959958
m_show_gcode_window = app_config->get_bool("show_gcode_window");
960959
if (m_networking_need_update) {

src/slic3r/GUI/HMS.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ int get_hms_info_version(std::string& version)
2020
AppConfig* config = wxGetApp().app_config;
2121
if (!config)
2222
return -1;
23+
if (config->get_stealth_mode())
24+
return -1;
2325
std::string hms_host = config->get_hms_host();
2426
if(hms_host.empty()) {
2527
BOOST_LOG_TRIVIAL(error) << "hms_host is empty";
@@ -58,6 +60,7 @@ int HMSQuery::download_hms_related(const std::string& hms_type, const std::strin
5860

5961
AppConfig* config = wxGetApp().app_config;
6062
if (!config) return -1;
63+
if (config->get_stealth_mode()) return -1;
6164

6265
std::string hms_host = wxGetApp().app_config->get_hms_host();
6366
std::string lang;
@@ -541,7 +544,11 @@ wxString HMSQuery::query_print_image_action(const MachineObject* obj, int print_
541544
char buf[32];
542545
::sprintf(buf, "%08X", print_error);
543546
//The first three digits of SN number
544-
return _query_error_image_action(get_dev_id_type(obj),std::string(buf), button_action);
547+
const auto result = _query_error_image_action(get_dev_id_type(obj),std::string(buf), button_action);
548+
if (wxGetApp().app_config->get_stealth_mode() && result.Contains("http")) {
549+
return wxEmptyString;
550+
}
551+
return result;
545552
}
546553

547554
wxImage HMSQuery::query_image_from_local(const wxString& image_name)
@@ -629,6 +636,7 @@ std::string get_hms_wiki_url(std::string error_code)
629636
{
630637
AppConfig* config = wxGetApp().app_config;
631638
if (!config) return "";
639+
if (config->get_stealth_mode()) return "";
632640

633641
std::string hms_host = wxGetApp().app_config->get_hms_host();
634642
std::string lang_code = HMSQuery::hms_language_code();
@@ -654,6 +662,8 @@ std::string get_hms_wiki_url(std::string error_code)
654662

655663
std::string get_error_message(int error_code)
656664
{
665+
if (wxGetApp().app_config->get_stealth_mode()) return "";
666+
657667
char buf[64];
658668
std::string result_str = "";
659669
std::sprintf(buf,"%08X",error_code);

0 commit comments

Comments
 (0)