Firstly, you should always be checking pointers before you use them. That part is non-negotiable.
Secondly, your issue is occurring because the GameState
hasn’t been created yet. The GameMode
is responsible for creating the GameState
, and its constructor is not responsible for doing that.
Please refer to this function, defined in GameModeBase.h