← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2568: 1. Backport doc generation crash (picked from subdomains)

 

------------------------------------------------------------
revno: 2568
committer: Václav Šmilauer <eu@xxxxxxxx>
branch nick: yade
timestamp: Wed 2010-11-24 17:31:33 +0100
message:
  1. Backport doc generation crash (picked from subdomains)
modified:
  core/InteractionContainer.cpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'core/InteractionContainer.cpp'
--- core/InteractionContainer.cpp	2010-11-19 12:30:08 +0000
+++ core/InteractionContainer.cpp	2010-11-24 16:31:33 +0000
@@ -49,7 +49,7 @@
 	int linIx=I->second->linIx; 
 	b1->intrs.erase(I);
 	// iid is not the last element; we have to move last one to its place
-	if (linIx<currSize-1) {
+	if (linIx<(int)currSize-1) {
 		linIntrs[linIx]=linIntrs[currSize-1];
 		linIntrs[linIx]->linIx=linIx; // update the back-reference inside the interaction
 	}
@@ -65,7 +65,9 @@
 	assert(bodies);
 	if (id1>id2) swap(id1,id2);
 	assert(id1<bodies->size() && id2<bodies->size());
+	if(id1>=(Body::id_t)bodies->size()) { empty=shared_ptr<Interaction>(); return empty; }
 	const shared_ptr<Body>& b1((*bodies)[id1]); assert(b1);
+	if(!b1) { empty=shared_ptr<Interaction>(); return empty; }
 	Body::MapId2IntrT::iterator I(b1->intrs.find(id2));
 	if (I!=b1->intrs.end()) return I->second;
 	else { empty=shared_ptr<Interaction>(); return empty; }