From c31906b0d15c010cbfdce660c814bdb36d05e7e1 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 12 Oct 2023 13:30:58 +0200 Subject: [PATCH] SPE-1926: Fixed crash introduced with 85e567788badabf7f9e89103a2333624814a5dd5 --- src/slic3r/GUI/Selection.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index d659f5cd29..29102d64d3 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -928,9 +928,12 @@ const std::pair Selection::get_bounding_sphere() const std::vector points; if (m_valid) { for (unsigned int i : m_list) { - const TriangleMesh* hull = (*m_volumes)[i]->convex_hull(); - const Transform3d& matrix = (*m_volumes)[i]->world_matrix(); - for (const Vec3f& v : hull->its.vertices) { + const GLVolume& volume = *(*m_volumes)[i]; + const TriangleMesh* hull = volume.convex_hull(); + const indexed_triangle_set& its = (hull != nullptr) ? + hull->its : m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh().its; + const Transform3d& matrix = volume.world_matrix(); + for (const Vec3f& v : its.vertices) { const Vec3d vv = matrix * v.cast(); points.push_back(Point(vv.x(), vv.y(), vv.z())); }