From 6c00a9dd38c9095efbdebb265735f55129c418ae Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 24 May 2023 12:20:32 +0200 Subject: [PATCH] Fixed a crash when wipe_tower_extruder is invalid --- src/libslic3r/PrintConfig.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index fa4e885f1..a8cc410ab 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -4346,6 +4346,14 @@ void DynamicPrintConfig::normalize_fdm() } } + if (this->has("wipe_tower_extruder")) { + // If invalid, replace with 0. + int extruder = this->opt("wipe_tower_extruder")->value; + int num_extruders = this->opt("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")) this->option("solid_infill_extruder", true)->setInt(this->option("infill_extruder")->getInt());