SFML and Box2D : b2RevoluteJoint crashes

Hi there ! 😀

I'm trying to make a Crayon Physics kinda game with Box2D and SFML, and
I have a little problem using joints, and more particularly the function
Initialize(), from the object b2RevoluteJointDef .. It crashes without
warning when I call it.

So I looked up the sources of Box2D, and wrote the code of the function
Initialize() in my constructor, so I could see where it crashes : it crashes
as soon as you set bodyA.

Here is my constructor :

Code:
Pin::Pin(CustomSpace* s, b2Body* f1, b2Body* f2, sf::Vector2f anchor)
{
    b2Vec2 a;
    a.x = anchor.x * METERS_PIXEL;
    a.y = anchor.y * METERS_PIXEL;

    if(f1 != NULL && f2 != NULL)
    {
        m_space = s;

        b2RevoluteJointDef* jointDef;
           jointDef->bodyA = f1; //It crashes as soon as here
           jointDef->bodyB = f2;
           jointDef->localAnchorA = b2Vec2(f1->GetPosition().x, HEIGHT - f1->GetPosition().y);
           jointDef->localAnchorB = f2->GetLocalPoint(a);

        m_joint = (b2RevoluteJoint*)m_space->getWorld()->CreateJoint(jointDef);

        m_shape = sf::Shape::Circle(anchor, 5, sf::Color(0, 209, 114));

        m_space->addPin(this);

    }
}

Where f1 is a body that is clicked on, f2 is another body that is clicked on, and
if it is equals to NULL, it is replace by a groundBody defined like this :

Code:
    b2BodyDef bg;
    bgbody = m_world->CreateBody(&bg);


At first, to make sure, I also printed on the terminal the position of each body,
and the position of the anchor, here is what I obtained :

anchor : 16.8333; 12.1333
f1 : 13.9833; 13.0945
f2 : 0; 0

I really cannot see what I did wrong here .. and why it crashes ...

Thanks for helping, if you see what I did wrong 🙂

[EDIT]

The error I receive is a Segmentation Fault, I don't understand why ..
This is a C programming problem, not a Box2D problem. Your joint def is an uninitialized pointer. You are writing to a random address in memory.
That was it ! Thank you so much :p

I don't know how I could not see that

Thank you again 😀

Original thread: https://box2d.org/forum/viewtopic.php?t=6802