From 53e358f32c50e5524316d5d82da788a0463a4de7 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 16 Jan 2023 09:59:41 +0100 Subject: [PATCH] Fix crash when cancelling part type change dialog --- src/slic3r/GUI/GUI_ObjectList.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 8a5d6f139a..0b03ecabe2 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -4301,7 +4301,10 @@ void ObjectList::change_part_type() int selection = 0; if (auto it = std::find(types.begin(), types.end(), type); it != types.end()) selection = it - types.begin(); - const auto new_type = types[wxGetApp().GetSingleChoiceIndex(_L("Type:"), _L("Select type of part"), names, selection)]; + + auto choice = wxGetApp().GetSingleChoiceIndex(_L("Type:"), _L("Select type of part"), names, selection); + const auto new_type = choice >= 0 ? types[choice] : ModelVolumeType::INVALID; + if (new_type == type || new_type == ModelVolumeType::INVALID) return;