From 159875940022c3bad08eb341dbbf596235718605 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 26 Feb 2024 09:54:42 +0100 Subject: [PATCH] Fixed crash on AMF loading (#12332, SPE-2175) --- src/libslic3r/Model.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index c7c53cf55d..52ef00594c 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -433,7 +433,11 @@ bool Model::looks_like_multipart_object() const return false; BoundingBoxf3 bb_this = obj->volumes[0]->mesh().bounding_box(); - BoundingBoxf3 tbb_this = obj->instances[0]->transform_bounding_box(bb_this); + + // FIXME: There is sadly the case when instances are empty (AMF files). The normalization of instances in that + // case is performed only after this function is called. For now (shortly before the 2.7.2 release, let's + // just do this non-invasive check. Reordering all the functions could break it much more. + BoundingBoxf3 tbb_this = (! obj->instances.empty() ? obj->instances[0]->transform_bounding_box(bb_this) : bb_this); if (!tbb.defined) tbb = tbb_this;