Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: NPE in BaseThemeGenerator.getInnerRadius()  (Read 229 times)

SafariJohn

  • Admiral
  • *****
  • Posts: 1969
    • View Profile
NPE in BaseThemeGenerator.getInnerRadius()
« 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.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18356
    • View Profile
Re: NPE in BaseThemeGenerator.getInnerRadius()
« Reply #1 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.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 3147
    • View Profile
    • Bitbucket profile
    • Email
Re: NPE in BaseThemeGenerator.getInnerRadius()
« Reply #2 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?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18356
    • View Profile
Re: NPE in BaseThemeGenerator.getInnerRadius()
« Reply #3 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.
Logged