RkShaRkz / Starsector-IntelliJ-Template

Starsector mod template with pre-configured IntelliJ project files and instructions.
The Unlicense
0 stars 1 forks source link

Fix bug in modular shields fix #57

Closed RkShaRkz closed 1 month ago

RkShaRkz commented 1 month ago

Well, while these things were in the sausage-long if(), it would have short-circuited before hitting the Object.equals(Object) call...

however, since all of these comparisons were extracted into individual booleans, the shortcircuiting logic still needs to be retained. So, that also had to be added.

This should resolve the following crash stacktrace:

ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException: Cannot invoke "Object.equals(Object)" because the return value of "com.fs.starfarer.api.combat.ShipAPI.getParentStation()" is null
java.lang.NullPointerException: Cannot invoke "Object.equals(Object)" because the return value of "com.fs.starfarer.api.combat.ShipAPI.getParentStation()" is null
    at data.scripts.hullmods.vayra_modular_shields.findGenerator(vayra_modular_shields.java:188) ~[?:?]
    at data.scripts.hullmods.vayra_modular_shields.advanceInCombat(vayra_modular_shields.java:141) ~[?:?]
    at com.fs.starfarer.combat.entities.Ship.advance(Unknown Source) ~[port_obf.jar:?]
    at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source) ~[port_obf.jar:?]
    at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source) ~[port_obf.jar:?]
    at com.fs.starfarer.combat.CombatState.traverse(Unknown Source) ~[port_obf.jar:?]
    at com.fs.state.AppDriver.begin(Unknown Source) ~[port.common_obf.jar:?]
    at com.fs.starfarer.combat.CombatMain.main(Unknown Source) ~[port_obf.jar:?]
    at com.fs.starfarer.StarfarerLauncher.super(Unknown Source) ~[port_obf.jar:?]
    at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source) ~[port_obf.jar:?]
    at java.base/java.lang.Thread.run(Thread.java:1575) [?:?]

Also, double the effectiveness of the caliph shield because I think it'd suit it better.