mirror of
https://github.com/love2d/love.git
synced 2026-08-18 03:34:23 +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
|
||||
{
|
||||
GearJoint::GearJoint(Joint * joint1, Joint * joint2, float ratio)
|
||||
: Joint(joint1->body2, joint2->body2)
|
||||
: Joint(joint1->body2, joint2->body2), joint(NULL)
|
||||
{
|
||||
b2GearJointDef def;
|
||||
def.joint1 = joint1->joint;
|
||||
|
||||
Reference in New Issue
Block a user