Fixed crash on AMF loading (#12332, SPE-2175)

This commit is contained in:
Lukas Matena 2024-02-26 09:54:42 +01:00
parent 3fdd02fff5
commit 1598759400

View File

@ -433,7 +433,11 @@ bool Model::looks_like_multipart_object() const
return false; return false;
BoundingBoxf3 bb_this = obj->volumes[0]->mesh().bounding_box(); 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) if (!tbb.defined)
tbb = tbb_this; tbb = tbb_this;