const int aShift = anEntity.point[aPnt] - anEntity.h;
int aPntInd = anEnt + aShift;
int aStep = 1;
+ if (aPntInd < 0)
+ aPntInd = 0;
+ else if (aPntInd >= myEquationsSystem.entities)
+ aPntInd = myEquationsSystem.entities - 1;
if (myEquationsSystem.entity[aPntInd].h > anEntity.point[aPnt])
aStep = -1;
for (; aPntInd >=0 && aPntInd < myEquationsSystem.entities; aPntInd += aStep)
// Search available coincidence
CoincidentPointsMap::iterator aMasterFound = myCoincidentPoints.find(theMaster);
CoincidentPointsMap::iterator aSlaveFound = myCoincidentPoints.find(theSlave);
- if (aMasterFound == myCoincidentPoints.end() && aSlaveFound == myCoincidentPoints.end()) {
+ if (aMasterFound == myCoincidentPoints.end() || aSlaveFound == myCoincidentPoints.end()) {
// try to find master and slave points in the lists of slaves of already existent coincidences
CoincidentPointsMap::iterator anIt = myCoincidentPoints.begin();
for (; anIt != myCoincidentPoints.end(); ++anIt) {