Skip to content

Commit

Permalink
Improving 3MF import: checking for invalid data.
Browse files Browse the repository at this point in the history
  • Loading branch information
bubnikv committed Feb 12, 2021
1 parent 2228c5e commit 9c568a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libslic3r/Format/3mf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ namespace Slic3r {
#endif // ENABLE_RELOAD_FROM_DISK_FOR_3MF

for (const IdToModelObjectMap::value_type& object : m_objects) {
if (object.second >= m_model->objects.size()) {
add_error("Unable to find object");
return false;
}
ModelObject* model_object = m_model->objects[object.second];
IdToGeometryMap::const_iterator obj_geometry = m_geometries.find(object.first);
if (obj_geometry == m_geometries.end()) {
Expand Down Expand Up @@ -1391,6 +1395,10 @@ namespace Slic3r {
{
// deletes all non-built or non-instanced objects
for (const IdToModelObjectMap::value_type& object : m_objects) {
if (object.second >= m_model->objects.size()) {
add_error("Unable to find object");
return false;
}
ModelObject *model_object = m_model->objects[object.second];
if (model_object != nullptr && model_object->instances.size() == 0)
m_model->delete_object(model_object);
Expand Down

0 comments on commit 9c568a5

Please sign in to comment.