From 83a2dc3b5a74c65a15447abfcc5daccf82e1b210 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 19 Apr 2023 12:06:16 +0200 Subject: [PATCH] Follow up https://github.com/Prusa-Development/PrusaSlicerPrivate/commit/9e56625287f2563ad974a266593821d49af5efbd - Added code to avoid a crash and allow to load 3mf even if cut information was corrupted --- src/libslic3r/Format/3mf.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index d08e3be31..f7f68f43f 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -867,9 +867,12 @@ namespace Slic3r { IdToCutObjectInfoMap::iterator cut_object_info = m_cut_object_infos.find(object.second + 1); if (cut_object_info != m_cut_object_infos.end()) { model_object->cut_id = cut_object_info->second.id; - + int vol_cnt = int(model_object->volumes.size()); for (auto connector : cut_object_info->second.connectors) { - assert(0 <= connector.volume_id && connector.volume_id <= int(model_object->volumes.size())); + if (connector.volume_id < 0 || connector.volume_id >= vol_cnt) { + add_error("Invalid connector is found"); + continue; + } model_object->volumes[connector.volume_id]->cut_info = ModelVolume::CutInfo(CutConnectorType(connector.type), connector.r_tolerance, connector.h_tolerance, true); }