PrusaSlicer/PrusaSlicer-2.9.0-pr13885-printconfig-segfault.patch

31 lines
1.3 KiB
Diff
Raw Normal View History

From aaa7ab6ca2b593a4f20a08292a6fb44339029474 Mon Sep 17 00:00:00 2001
From: Ryan Heule <rmheule@yahoo.com>
Date: Wed, 1 Jan 2025 16:36:04 -0600
Subject: [PATCH] Avoid null pointer dereference for partial configuration
settings
---
src/libslic3r/PrintConfig.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index 907fdfb02a..efa9be9760 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -5130,7 +5130,14 @@ void DynamicPrintConfig::normalize_fdm()
}
}
- if (this->has("wipe_tower_extruder")) {
+ // This method is called repeatedly while building configuration. We may
+ // not have enough info yet to determine whether the extruder is valid;
+ // wait until we do before checking.
+ //
+ // NOTE: other extruder validation (e.g. perimeter_extruder, infill_extruder)
+ // happens elsewhere, as those settings can be modified for specific print
+ // objects or sometimes even regions of objects.
+ if (this->has("wipe_tower_extruder") && this->has("nozzle_diameter")) {
// If invalid, replace with 0.
int extruder = this->opt<ConfigOptionInt>("wipe_tower_extruder")->value;
int num_extruders = this->opt<ConfigOptionFloats>("nozzle_diameter")->size();