diff --git a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp index b33b0b2022..a8dc16c558 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp @@ -259,9 +259,11 @@ void Raycaster::on_update() bool force_raycaster_regeneration = false; if (wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA) { // For sla printers we use the mesh generated by the backend + std::shared_ptr preview_mesh_ptr; const SLAPrintObject* po = get_pool()->selection_info()->print_object(); - assert(po != nullptr); - std::shared_ptr preview_mesh_ptr = po->get_mesh_to_print(); + if (po) + preview_mesh_ptr = po->get_mesh_to_print(); + if (preview_mesh_ptr) m_sla_mesh_cache = TriangleMesh{*preview_mesh_ptr}; @@ -323,12 +325,13 @@ void ObjectClipper::on_update() if (wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA) { // For sla printers we use the mesh generated by the backend const SLAPrintObject* po = get_pool()->selection_info()->print_object(); - assert(po != nullptr); - auto partstoslice = po->get_parts_to_slice(); - if (! partstoslice.empty()) { - mc = std::make_unique(); - mc->set_mesh(range(partstoslice)); - mc_tr = Geometry::Transformation{po->trafo().inverse().cast()}; + if (po) { + auto partstoslice = po->get_parts_to_slice(); + if (! partstoslice.empty()) { + mc = std::make_unique(); + mc->set_mesh(range(partstoslice)); + mc_tr = Geometry::Transformation{po->trafo().inverse().cast()}; + } } }