mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-14 07:52:56 +00:00
Fix crash on printer switch from stale filament/extruder indices (#14103)
Switching to a printer with fewer filaments (e.g. H2D -> X2D) threw std::out_of_range in check_filament_printable. Clear stale per-volume extruder config on count shrink and bound-check filament indices at the read sites.
This commit is contained in:
@@ -764,6 +764,10 @@ void ObjectList::update_filament_values_for_items(const size_t filaments_count)
|
||||
if (!object->volumes[id]->config.has("extruder") ||
|
||||
size_t(object->volumes[id]->config.extruder()) > filaments_count) {
|
||||
extruder = wxString::Format("%d", object->config.extruder());
|
||||
// Clear the stale per-volume assignment so it falls back to the object's
|
||||
// extruder; otherwise the out-of-range index survives. Ported from
|
||||
// BambuStudio (STUDIO-15763).
|
||||
object->volumes[id]->config.erase("extruder");
|
||||
}
|
||||
else {
|
||||
extruder = wxString::Format("%d", object->volumes[id]->config.extruder());
|
||||
|
||||
Reference in New Issue
Block a user