Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95a is out! (03/26/21); Blog post: A Tale of Two Tech Levels (05/28/21)

Author Topic: [0.95a-RC15] Odd save load failure  (Read 188 times)

Histidine

  • Admiral
  • *****
  • Posts: 3241
    • View Profile
    • Bitbucket profile
    • Email
[0.95a-RC15] Odd save load failure
« on: June 10, 2021, 11:41:31 PM »

Recently, at least three people on the Discord have experienced an unusual error with a save failing to load.

Sample error:
Spoiler

51291 [Thread-3] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading CSV data from [DIRECTORY: C:\Users\Yonik\Desktop\Starsector 0.95a\starsector-core\..\mods\Nexerelin]
51311 [Thread-3] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Error loading
51311 [Thread-3] ERROR com.fs.starfarer.campaign.save.CampaignGameManager  - Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.NullPointerException
cause-message       : null
method              : com.fs.starfarer.campaign.fleet.FleetMember.readResolve()
class               : com.fs.starfarer.campaign.fleet.FleetMember
required-type       : com.fs.starfarer.campaign.fleet.FleetMember
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
line number         : 425180
class[1]            : java.util.HashMap
converter-type[1]   : com.thoughtworks.xstream.converters.collections.MapConverter
class[2]            : com.fs.starfarer.campaign.ModAndPluginData
class[3]            : com.fs.starfarer.campaign.CampaignEngine
converter-type[2]   : com.fs.starfarer.campaign.save.I
version             : not available
-------------------------------
com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.NullPointerException
cause-message       : null
method              : com.fs.starfarer.campaign.fleet.FleetMember.readResolve()
class               : com.fs.starfarer.campaign.fleet.FleetMember
required-type       : com.fs.starfarer.campaign.fleet.FleetMember
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
line number         : 425180
class[1]            : java.util.HashMap
converter-type[1]   : com.thoughtworks.xstream.converters.collections.MapConverter
class[2]            : com.fs.starfarer.campaign.ModAndPluginData
class[3]            : com.fs.starfarer.campaign.CampaignEngine
converter-type[2]   : com.fs.starfarer.campaign.save.I
version             : not available
-------------------------------
   at com.thoughtworks.xstream.core.util.SerializationMembers.callReadResolve(SerializationMembers.java:82)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshal(AbstractReflectionConverter.java:282)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.rea dItem(AbstractCollectionConverter.java:73)
   at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryInt oMap(MapConverter.java:110)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:98)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:92)
   at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:87)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.rea dItem(AbstractCollectionConverter.java:73)
   at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryInt oMap(MapConverter.java:110)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:98)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:92)
   at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:87)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.rea dItem(AbstractCollectionConverter.java:73)
   at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryInt oMap(MapConverter.java:110)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:98)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:92)
   at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:87)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshallField(AbstractReflectionConverter.java:503)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUn marshal(AbstractReflectionConverter.java:429)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshal(AbstractReflectionConverter.java:281)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshallField(AbstractReflectionConverter.java:503)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUn marshal(AbstractReflectionConverter.java:429)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unma rshal(AbstractReflectionConverter.java:281)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
   at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
   at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1486)
   at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1466)
   at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1346)
   at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
   at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
   at com.fs.starfarer.title.TitleScreenState.menuItemSelected(Unknown Source)
   at com.fs.starfarer.title.Object.actionPerformed(Unknown Source)
   at com.fs.starfarer.ui.newnew.buttonPressed(Unknown Source)
   at com.fs.starfarer.ui.I.Ò00000(Unknown Source)
   at com.fs.starfarer.ui.I.processInput(Unknown Source)
   at com.fs.starfarer.ui.Stringsuper.super(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)
Caused by: java.lang.NullPointerException
   at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.getSupply(BaseIndustry.java:734)
   at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.supply(BaseIndustry.java:316)
   at com.fs.starfarer.api.impl.campaign.econ.ResourceDepositsCondition.apply(ResourceDepositsCondition.java:193)
   at com.fs.starfarer.campaign.econ.Market.reapplyConditions(Unknown Source)
   at com.fs.starfarer.campaign.CharacterStats.refreshAllOutpostsEffectsForPlayerOutp osts(Unknown Source)
   at com.fs.starfarer.campaign.CharacterStats.refreshCharacterStatsEffects(Unknown Source)
   at com.fs.starfarer.api.impl.hullmods.PhaseField.onFleetSync(PhaseField.java:63)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getCommander(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetMember.updateStats(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetMember.readResolve(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.thoughtworks.xstream.core.util.SerializationMembers.callReadResolve(SerializationMembers.java:78)
   ... 63 more

[close]

The stack trace goes through some strange places, to say the least:
Code
Caused by: java.lang.NullPointerException
at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.getSupply(BaseIndustry.java:734)
at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.supply(BaseIndustry.java:316)
at com.fs.starfarer.api.impl.campaign.econ.ResourceDepositsCondition.apply(ResourceDepositsCondition.java:193)
at com.fs.starfarer.campaign.econ.Market.reapplyConditions(Unknown Source)
at com.fs.starfarer.campaign.CharacterStats.refreshAllOutpostsEffectsForPlayerOutposts(Unknown Source)
at com.fs.starfarer.campaign.CharacterStats.refreshCharacterStatsEffects(Unknown Source)
at com.fs.starfarer.api.impl.hullmods.PhaseField.onFleetSync(PhaseField.java:63)
at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
at com.fs.starfarer.campaign.fleet.FleetData.getCommander(Unknown Source)
at com.fs.starfarer.campaign.fleet.FleetMember.updateStats(Unknown Source)
at com.fs.starfarer.campaign.fleet.FleetMember.readResolve(Unknown Source)
Is stuff being loaded out of order (so it tries to sync the player fleet before the industries get their supply fields regenerated)?
Is there a user-side way to fix this?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18676
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #1 on: June 11, 2021, 11:59:10 AM »

Hmm - due to some changes to how phase field works, this shouldn't be an issue in the next release.

As far as a user-side fix... I'm not sure. The only thing that comes to mind is replacing the PhaseField hull mod effect with a copy whose onFleetSync() method just doesn't call refreshCharacterStatsEffects(). That method would still get called from other places so the worst you'd get out of this is occasionally slightly incorrect sensor profiles.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 3241
    • View Profile
    • Bitbucket profile
    • Email
Re: [0.95a-RC15] Odd save load failure
« Reply #2 on: June 12, 2021, 11:29:11 PM »

As far as a user-side fix... I'm not sure. The only thing that comes to mind is replacing the PhaseField hull mod effect with a copy whose onFleetSync() method just doesn't call refreshCharacterStatsEffects(). That method would still get called from other places so the worst you'd get out of this is occasionally slightly incorrect sensor profiles.
That seems to work, thanks!

For anyone searching for this issue and finding this thread, I've made a quick fix mod.
Download
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18676
    • View Profile
Re: [0.95a-RC15] Odd save load failure
« Reply #3 on: June 13, 2021, 11:10:44 AM »

(Nice!)
Logged