Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); In-development patch notes for Starsector 0.98a (2/8/25)

Author Topic: Crash when clicking on re-generate fleet button, maybe more.  (Read 528 times)

Cracked Emerald

  • Ensign
  • *
  • Posts: 12
    • View Profile
Crash when clicking on re-generate fleet button, maybe more.
« on: January 15, 2024, 08:22:58 PM »

Hi, i'm playing some modded starsector, and am getting very reliable crashes when using the fleet doctrine screen. This log, is when i clicked the re-generate fleet button after adjusting some things, right after loading the game.
 
251223 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.api.impl.campaign.fleets.DefaultFleetInflater.inflate(DefaultFleetInflater.java:453)
   at com.fs.starfarer.campaign.fleet.CampaignFleet.inflateIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.command.J.updateSampleFleet(Unknown Source)
   at com.fs.starfarer.campaign.command.J.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.thissuper.advance(Unknown Source)
   at com.fs.starfarer.ui.interfacenew.advanceImpl(Unknown Source)
   at com.fs.starfarer.campaign.command.F.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.thissuper.advance(Unknown Source)
   at com.fs.starfarer.ui.interfacenew.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.newui.o0OO.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.thissuper.advance(Unknown Source)
   at com.fs.starfarer.ui.interfacenew.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.public.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.newui.L.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.thissuper.advance(Unknown Source)
   at com.fs.starfarer.ui.interfacenew.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.thissuper.advance(Unknown Source)
   at com.fs.starfarer.campaign.CampaignState.advance(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)


It's not the only crash on that screen, but the newest one.

Here's the modlist:

  "pantera_ANewLevel40R",
  "BSC",
  "CaptainsLog",
  "lw_radar",
  "lw_console",
  "diyplanets",
  "lw_lazylib",
  "lunalib",
  "MagicLib",
  "ness_saw",
  "officerExtension",
  "planet_search",
  "swp",
  "stardustventures",
  "sun_starship_legends",
  "superweapons",
  "unthemedweapons",
  "WEAPONARCS",
  "whichmod",
  "shaderLib"


Logged

Histidine

  • Admiral
  • *****
  • Posts: 4976
    • View Profile
    • GitHub profile
Re: Crash when clicking on re-generate fleet button, maybe more.
« Reply #1 on: January 15, 2024, 10:59:49 PM »

Did you recently update any mods that add ships? This issue can happen if a mod update removes a ship's autofit variants that previously existed.
I don't know if there's any way to fix this other than rolling back the mod, or manually readding a variant with the same ID as the removed one.
(EDIT 1 Sep 2024: In principle it might also be possible to look in the save's campaign.xml and replace all instances of the missing variant(s), although I have not attempted this)

Untested quick Console Commands runcode to find affected ships (copy and paste into the console):
Code: java
runcode import Global.*;
for (ShipHullSpecAPI spec : Global.getSettings().getAllShipHullSpecs()) {
String hullId = spec.getHullId();
List<ShipVariantAPI> targets = Global.getSector().getAutofitVariants().getTargetVariants(hullId);
for (ShipVariantAPI curr : targets) {
if (curr == null) {
Console.showMessage("Null variant found for hull ID " + hullId);
}
}
}

[Further edit]
Once the hull IDs with missing variants are found, they can be removed in the following way:

1) Run the following in console:
Code: java
runcode import Global.*;
String hullId = "aurora";
List<ShipVariantAPI> targets = Global.getSector().getAutofitVariants().getTargetVariants(hullId);
for (ShipVariantAPI curr : targets) {
    if (curr != null) {
        Console.showMessage("Found variant ID " + curr.getHullVariantId());
    }
}
2) Open the save's campaign.xml file in Notepad++ or similar and search for `aurora_`, if there are any variant IDs not in the list found by the console runcode, replace them with one that is. Make sure not to replace hull IDs by mistake.
« Last Edit: September 01, 2024, 09:44:03 PM by Histidine »
Logged

Cracked Emerald

  • Ensign
  • *
  • Posts: 12
    • View Profile
Re: Crash when clicking on re-generate fleet button, maybe more.
« Reply #2 on: January 16, 2024, 07:22:51 AM »

yes, that must be the issue. Nes' SAW's Hammerfall got updated. It's six drones and it's built in surveying equipment got removed, that must be the issue.
That's probaly the reason why clicking the autofit button crashes it also.
Logged