Simsilica / SiO2

Base pack of useful reusable game code that can help bootstrap any JME game project.
BSD 3-Clause "New" or "Revised" License
25 stars 7 forks source link

NPE in CompositeAppState when adding child before initialization #5

Closed NemesisMate closed 5 years ago

NemesisMate commented 7 years ago

If the addChild is called (on CompositeAppState) between the attach and initialization processes it throws a NPE due to:

        if( attached ) {
            getApplication().getStateManager().attach(state);
        }

the the application being null (it is being set on the BaseAppState initialization). So, this check should be if it is initialized instead of attached or the application should be set on the attachment moment instead of initialization in order to fix this issue.

pspeed42 commented 5 years ago

This should be fixed now in the latest version. Reopen if not.