mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
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:
@@ -31,7 +31,7 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
DistanceJoint::DistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2)
|
||||
: Joint(body1, body2)
|
||||
: Joint(body1, body2), joint(NULL)
|
||||
{
|
||||
b2DistanceJointDef def;
|
||||
def.Initialize(body1->body, body2->body, world->scaleDown(b2Vec2(x1,y1)), world->scaleDown(b2Vec2(x2,y2)));
|
||||
|
||||
Reference in New Issue
Block a user