diff --git a/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp b/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp index 0cd6fb2c2e..d4a7f20241 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp +++ b/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp @@ -221,15 +221,18 @@ wxString DevAms::GetDisplayName() const int DevAms::GetSlotCount() const { - // GetAmsType() maps AMS_LITE_MIXED -> AMS_LITE, so N9 reports 4 slots like AMS-Lite. - auto ams_type = GetAmsType(); - if (ams_type == AMS || ams_type == AMS_LITE || ams_type == N3F) - { - return 4; - } - else if (ams_type == N3S) - { - return 1; + if (wxTheApp != nullptr && GUI::wxGetApp().preset_bundle != nullptr && + GUI::wxGetApp().preset_bundle->is_bbl_vendor()) { + // GetAmsType() maps AMS_LITE_MIXED -> AMS_LITE, so N9 reports 4 slots like AMS-Lite. + auto ams_type = GetAmsType(); + if (ams_type == AMS || ams_type == AMS_LITE || ams_type == N3F) + { + return 4; + } + else if (ams_type == N3S) + { + return 1; + } } return static_cast(m_trays.size()); diff --git a/src/slic3r/GUI/DeviceCore/DevNozzleSystem.cpp b/src/slic3r/GUI/DeviceCore/DevNozzleSystem.cpp index 304d84097f..d4f50ed10b 100644 --- a/src/slic3r/GUI/DeviceCore/DevNozzleSystem.cpp +++ b/src/slic3r/GUI/DeviceCore/DevNozzleSystem.cpp @@ -176,7 +176,9 @@ int DevNozzle::GetLogicExtruderId() const { int total_ext_count = GetTotalExtruderCount(); - if (GUI::wxGetApp().preset_bundle->is_bbl_vendor()) { + const bool is_bbl_vendor = wxTheApp != nullptr && GUI::wxGetApp().preset_bundle != nullptr && + GUI::wxGetApp().preset_bundle->is_bbl_vendor(); + if (is_bbl_vendor) { if (total_ext_count == 1) { return LOGIC_UNIQUE_EXTRUDER_ID; } else if (total_ext_count == 2) { @@ -201,7 +203,9 @@ int DevNozzle::GetLogicExtruderId() const int DevNozzle::GetExtruderId() const { - if (GUI::wxGetApp().preset_bundle->is_bbl_vendor()) { + const bool is_bbl_vendor = wxTheApp != nullptr && GUI::wxGetApp().preset_bundle != nullptr && + GUI::wxGetApp().preset_bundle->is_bbl_vendor(); + if (is_bbl_vendor) { int total_ext_count = GetTotalExtruderCount(); if (total_ext_count == 1) { return MAIN_EXTRUDER_ID; diff --git a/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp b/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp index b26bcf80f4..6f7fc4a4af 100644 --- a/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp +++ b/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp @@ -419,6 +419,14 @@ ExtruderBadge::ExtruderBadge(wxWindow* parent) : wxPanel(parent) void ExtruderBadge::SetExtruderInfo(int extruder_id, const std::string& diameter, const NozzleVolumeType& volume_type) { + // The badge renders exactly two extruders (left/right). A generic non-BBL printer with + // N > 2 can report an out-of-range id here (see MultiNozzleStatusTable::UpdateRackInfo); + // reject it rather than writing past the two-element lists. + if (extruder_id < 0 || extruder_id >= static_cast(m_diameter_list.size())) { + BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": out-of-range extruder_id " << extruder_id; + return; + } + m_diameter_list[extruder_id] = diameter; m_volume_type_list[extruder_id] = volume_type;