Fractal Softworks Forum

Starsector => Bug Reports & Support => Bug Reports & Support (modded) => Topic started by: SafariJohn on April 01, 2021, 10:34:30 AM

Title: NPE in BaseThemeGenerator.getInnerRadius()
Post by: SafariJohn on April 01, 2021, 10:34:30 AM
I got a non-reproducible NPE on line 1204 of BaseThemeGenerator in getInnerRadius(), which is the SINGLE/BINARY_FAR/TRINARY_2FAR case of the system type switch. The star system was passed in from my Roider Union code, but it came from a list populated using

Code: java
if (s.getId().equals(market.getStarSystem().getId())) continue;
so it should have crashed there if the system was null. That means system.getStar() must have returned null. Unfortunately it happened before new game creation finished, so I don't have a save.

All my Roider systems go through this code without throwing the NPE, and I don't have any other faction/etc. mods enabled, so it seems most probable to me that something in vanilla is randomly putting out a nebula system with type SINGLE.
Title: Re: NPE in BaseThemeGenerator.getInnerRadius()
Post by: Alex on April 02, 2021, 12:37:47 PM
Thank you! Fixed this up. Was caused by the [TOPSECRET] location, which has a SINGLE type without having a star.
Title: Re: NPE in BaseThemeGenerator.getInnerRadius()
Post by: Histidine on April 11, 2021, 07:40:36 AM
Trying a modside fix: If I just called system.setType(StarSystemType.NEBULA); on the system in onNewGameAfterProcGen(), would that solve it?
Title: Re: NPE in BaseThemeGenerator.getInnerRadius()
Post by: Alex on April 11, 2021, 10:19:44 AM
I *think* so. The way to test the fix would be to call BaseThemeGenerator.getInnerRadius() - it's a static method with no parameters aside from the system so this should be relatively easy to verify.