I’m telling you… with 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000% certainty:
If that’s the line the NPE is on. That value is null. !00% guaranteed or all your money back.
It’s up to you to sort out the spaghetti to figure out why. But often it’s the case with static globals that you set it in one case but not another, or this code runs before the code that set it, or 10000 different things that come from crappy design like this instead of using proper initialization, app states, and so on.
Edit: actually, if you don’t believe me… just use the most basic debugging building block and print the value right before that line.
Edit 2: I’ve also made (perhaps most egregiously) the assumption that MyCityBuilder is a class and that MainGameClass is an inner class… but that’s just based on the usage and naming. Given that you name your fields like classes then that could be a bad assumption on my part. In which case, either of those could be null also.