From e9d967f4b273eb7e37b22ecde41ff882ab9010a9 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 7 Aug 2023 12:58:17 +0200 Subject: [PATCH] Fix for #11070 - Crash on cut --- src/slic3r/GUI/Plater.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index af6fdc3bf4..9c8297b29c 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1276,9 +1276,11 @@ void Sidebar::show_info_sizer() { Selection& selection = wxGetApp().plater()->canvas3D()->get_selection(); ModelObjectPtrs objects = p->plater->model().objects; - int obj_idx = selection.get_object_idx(); + const int obj_idx = selection.get_object_idx(); + const int inst_idx = selection.get_instance_idx(); if (m_mode < comExpert || objects.empty() || obj_idx < 0 || int(objects.size()) <= obj_idx || + inst_idx < 0 || int(objects[obj_idx]->instances.size()) <= inst_idx || objects[obj_idx]->volumes.empty() || // hack to avoid crash when deleting the last object on the bed (selection.is_single_full_object() && objects[obj_idx]->instances.size()> 1) || !(selection.is_single_full_instance() || selection.is_single_volume())) { @@ -1288,9 +1290,6 @@ void Sidebar::show_info_sizer() const ModelObject* model_object = objects[obj_idx]; - int inst_idx = selection.get_instance_idx(); - assert(inst_idx >= 0); - bool imperial_units = wxGetApp().app_config->get_bool("use_inches"); double koef = imperial_units ? ObjectManipulation::mm_to_in : 1.0f;