Segfault in InputHandler::update when moving joystick

gdb says I’m getting a segfault in InputHandler::update, is it that the if else and for loops are not correctly separated, where do I need to add remove french braces? thanks.

InputHanfler.cpp and all other files of the game engine are included below.

I’m a complete noob and I find nested if else and for statements really hard to debug so any help is greatly appreciated. Thanks.

https://drive.google.com/open?id=1o6nLpkkKs9aafBMv1Q3AXYEmX0a_YkAX

The indentation in InputHandler::update() is all over the place, so I understand why you’re having a hard time debugging your code. You really need to start indenting it better, so that curly brackets are correctly aligned etc. You also really need to learn using the debugger and setting out breakpoints, so you can stop the execution of the code and check variables and values during run-time.