From ded96083bbc955fbc43072e04334fb952885aeaf Mon Sep 17 00:00:00 2001 From: "jiaxi.chen" Date: Wed, 16 Apr 2025 15:45:16 +0800 Subject: [PATCH] Fix: crash when top_interface_layer==1 in NormalSupport it's caused by "33666: ENH: add transition_layer for normal support | https://gerrit.bambooolab.com/c/bbl/bamboo_slicer/+/33666", when top_interface_layer==1, return size_t(-1). jira: none Change-Id: Id0f5e53165df96bf955cddcaf66c97c179e132c1 (cherry picked from commit 73e9023b5644dd8bf89243cc2cba5f936ad4f3e9) --- src/libslic3r/Support/SupportParameters.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Support/SupportParameters.hpp b/src/libslic3r/Support/SupportParameters.hpp index d874b66bb..5f2a3ed83 100644 --- a/src/libslic3r/Support/SupportParameters.hpp +++ b/src/libslic3r/Support/SupportParameters.hpp @@ -43,7 +43,7 @@ struct SupportParameters { // support_filament==0 bool differnt_support_interface_filament = object_config.support_interface_filament != 0 && object_config.support_interface_filament != object_config.support_filament; - this->num_top_base_interface_layers = differnt_support_interface_filament ? 2 : 0; + this->num_top_base_interface_layers = differnt_support_interface_filament && num_top_interface_layers > 0 ? 2 : 0; this->num_bottom_base_interface_layers = differnt_support_interface_filament ? 1 : 0; } } @@ -235,7 +235,7 @@ struct SupportParameters { bool has_contacts() const { return this->has_top_contacts || this->has_bottom_contacts; } bool has_interfaces() const { return this->num_top_interface_layers + this->num_bottom_interface_layers > 0; } bool has_base_interfaces() const { return this->num_top_base_interface_layers + this->num_bottom_base_interface_layers > 0; } - size_t num_top_interface_layers_only() const { return this->num_top_interface_layers - this->num_top_base_interface_layers; } + size_t num_top_interface_layers_only() const { return std::max(0, int(this->num_top_interface_layers) - int(this->num_top_base_interface_layers)); } size_t num_bottom_interface_layers_only() const { return this->num_bottom_interface_layers - this->num_bottom_base_interface_layers; } Flow first_layer_flow; Flow support_material_flow;