Fixed a crash when wipe_tower_extruder is invalid

This commit is contained in:
Lukas Matena 2023-05-24 12:20:32 +02:00
parent 88d7620c06
commit 6c00a9dd38

View File

@ -4346,6 +4346,14 @@ void DynamicPrintConfig::normalize_fdm()
} }
} }
if (this->has("wipe_tower_extruder")) {
// If invalid, replace with 0.
int extruder = this->opt<ConfigOptionInt>("wipe_tower_extruder")->value;
int num_extruders = this->opt<ConfigOptionFloats>("nozzle_diameter")->size();
if (extruder < 0 || extruder > num_extruders)
this->option("wipe_tower_extruder")->setInt(0);
}
if (!this->has("solid_infill_extruder") && this->has("infill_extruder")) if (!this->has("solid_infill_extruder") && this->has("infill_extruder"))
this->option("solid_infill_extruder", true)->setInt(this->option("infill_extruder")->getInt()); this->option("solid_infill_extruder", true)->setInt(this->option("infill_extruder")->getInt());