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:
@@ -36,8 +36,8 @@ namespace box2d
|
||||
for(int i = 0; i<def->vertexCount; i++)
|
||||
def->vertices[i] = body->world->scaleDown(def->vertices[i]);
|
||||
|
||||
def->userData = (void*)data;
|
||||
shape = body->body->CreateShape(def);
|
||||
shape->SetUserData((void*)data);
|
||||
}
|
||||
|
||||
PolygonShape::~PolygonShape()
|
||||
|
||||
Reference in New Issue
Block a user