From 4ee6972a725f02500c2c543abeef2909180e09c1 Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 26 May 2014 13:36:17 +0400 Subject: [PATCH] Updates for stability of application --- src/Model/Model_Document.cpp | 2 +- src/SketchSolver/SketchSolver_ConstraintManager.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 6f3b4a7a9..76b72fe0c 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -577,7 +577,7 @@ boost::shared_ptr Model_Document::objectByFeature( for(int a = 0; a < size(theFeature->getGroup()); a++) { boost::shared_ptr anObj = boost::dynamic_pointer_cast(feature(theFeature->getGroup(), a)); - if (anObj) { + if (anObj && anObj->featureRef() == theFeature) { return anObj; } } diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index 7edc1da33..80a1b4872 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -771,8 +771,11 @@ void SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::mergeGroups( std::map, Slvs_hEntity>::const_iterator aSPEntMapIter = theGroup.myEntityMap.begin(); - for ( ; aSPEntMapIter != theGroup.myEntityMap.end(); aSPEntMapIter++) - myEntityMap[aSPEntMapIter->first] = anEntityMap.find(aSPEntMapIter->second)->second; + for ( ; aSPEntMapIter != theGroup.myEntityMap.end(); aSPEntMapIter++) { + std::map::iterator aFind = anEntityMap.find(aSPEntMapIter->second); + if (aFind != anEntityMap.end()) + myEntityMap[aSPEntMapIter->first] = aFind->second; + } // Add temporary constraints std::list::const_iterator aTempConstrIter = theGroup.myTempConstraints.begin(); -- 2.39.2