Add NULL initializers for pointers.

Constructing invalid shapes, e.g. a rectangle with width 0, could result
in a b2Assert to fail. In turn, Shape::~Shape tried to destroy a the shape
with an uninitialized pointer, yielding a segfault. Add NULL-initializers
and checks for NULL to prevent this.
This commit is contained in:
vrld
2011-01-25 13:24:39 +01:00
parent 98406370eb
commit 1c7e34715b
11 changed files with 16 additions and 13 deletions
+2 -1
View File
@@ -117,7 +117,8 @@ namespace box2d
void Joint::destroyJoint(b2Joint * joint)
{
world->world->DestroyJoint(joint);
if (joint != NULL)
world->world->DestroyJoint(joint);
}
} // box2d