SDL_Event; EXC_BAD_ACCESS

Hello guys!

I am currently experiencing an error I do not understand and I hope somebody can help me.
Sometimes when starting my game I receive the following error:

Thread 1: EXC_BAD_ACCESS (code=1, adress=0x8).

When I check the console the problem is located in my InputHandler.cpp File in the following function:

Code:

void InputHandler::ProcessEvents()
{
SDL_Event event;

while(SDL_PollEvent(&event))
{
    switch (event.type)
    {
        // Input->Mouse
        case SDL_MOUSEMOTION:
            onMouseMove(event);
            break;
            
        case SDL_MOUSEBUTTONDOWN:
            onMouseButtonDown(event);
            break;
            
        case SDL_MOUSEBUTTONUP:
            onMouseButtonUp(event);
            break;
        
        // Input->Keyboard
        case SDL_KEYDOWN:
            onKeyDown();
            break;
            
        case SDL_KEYUP:
            onKeyUp();
            break;
            
        // Input->Quit
        case SDL_QUIT:
            bGameRun = false;
            break;
        
        default:
            break;
    }
}

}

Overtime when the event.type = (Uint32) is 56 it seems not to work.
Did anyone experience a same problem? What’s wrong with the event.type = 56?

Thank you in advance.
Eric

KPEric wrote:

When I check the console the problem is located in my InputHandler.cpp File in the following function:

What line does it crash on? Is it the same every time?

– David L.