From c5358ee3072266c2550bf18ca2e95da589d89e09 Mon Sep 17 00:00:00 2001 From: jrheinlaender Date: Sun, 7 Jul 2013 11:29:16 +0200 Subject: [PATCH] Prevent unknown exception thrown while loading a part --- src/Mod/PartDesign/App/DatumPlane.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/App/DatumPlane.cpp b/src/Mod/PartDesign/App/DatumPlane.cpp index fec4ff5bc..9f95deb7f 100644 --- a/src/Mod/PartDesign/App/DatumPlane.cpp +++ b/src/Mod/PartDesign/App/DatumPlane.cpp @@ -182,10 +182,14 @@ void Plane::onChanged(const App::Property *prop) if (prop == &References) { refTypes.clear(); std::vector refs = References.getValues(); - std::vector refnames = References.getSubValues(); + std::vector refnames = References.getSubValues(); - for (int r = 0; r < refs.size(); r++) + for (int r = 0; r < refs.size(); r++) { + const Part::Feature* ref = static_cast(refs[r]); + if ((ref != NULL) && ref->Shape.getValue().IsNull()) + continue; // This can happen while a document is being restored from a file refTypes.insert(getRefType(refs[r], refnames[r])); + } if (fabs(Angle.getValue()) > Precision::Confusion()) refTypes.insert(ANGLE);