mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Prevent attaching a MouseJoint to a kinematic body (fixes #1185)
It turns out, calling World:update() after attaching a MouseJoint to a kinematic body causes an exception. Normally the wrapper catches the exception, but somehow this exception cannot be caught. Wonderful.
This commit is contained in:
@@ -36,6 +36,9 @@ MouseJoint::MouseJoint(Body *body1, float x, float y)
|
||||
: Joint(body1)
|
||||
, joint(NULL)
|
||||
{
|
||||
if (body1->getType() == Body::BODY_KINEMATIC)
|
||||
throw love::Exception("Cannot attach a MouseJoint to a kinematic body");
|
||||
|
||||
b2MouseJointDef def;
|
||||
|
||||
def.bodyA = body1->world->getGroundBody();
|
||||
|
||||
Reference in New Issue
Block a user