Jump to content

About the new StarmapHexCellInventory subsystem


Sanchozz
  • Branch: Preview Branch Version: Linux Fixed

The game may crash when trying to load a save file if any mod has added a modded artifact or other item, and then the user has disabled this mod.

457140_20251115123432_1.png.470429ac9f8655b1d406e35fb986a9dc.png

[ERROR] StarmapHexCellInventory ~~~!System.NullReferenceException: Object reference not set to an instance of an object
  at KPrefabIDExtensions.HasTag (UnityEngine.GameObject go, Tag tag) [0x00001] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at ArtifactPOIStates+Instance+<>c.<HasArtifactAvailableInHexCell>b__15_0 (StarmapHexCellInventory+SerializedItem i) [0x00013] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at System.Collections.Generic.List`1[T].Find (System.Predicate`1[T] match) [0x0000d] in <9c9d7808da6a43e3b68409f2b63b3e6f>:0 
  at ArtifactPOIStates+Instance.HasArtifactAvailableInHexCell () [0x00007] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at ArtifactPOIStates.IsArtifactAvailableInHexCell (ArtifactPOIStates+Instance smi) [0x00000] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at ArtifactPOIStates.IsArtifactAvailableInHexCell (ArtifactPOIStates+Instance smi, StateMachine`4+SignalParameter[StateMachineType,StateMachineInstanceType,MasterType,DefType] param) [0x00000] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at StateMachine`4+Parameter`1+Transition[StateMachineType,StateMachineInstanceType,MasterType,DefType,ParameterType].Evaluate (StateMachine+Instance smi) [0x00053] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at StateMachine`4+Signal+Context[StateMachineType,StateMachineInstanceType,MasterType,DefType].Set (StateMachine`4+SignalParameter[StateMachineType,StateMachineInstanceType,MasterType,DefType] value, StateMachineInstanceType smi, System.Boolean silenceEvents) [0x00015] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at StateMachine`4+Signal[StateMachineType,StateMachineInstanceType,MasterType,DefType].Trigger (StateMachineInstanceType smi) [0x00013] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at ArtifactPOIStates+Instance.OnHexCellInventoryChanged (System.Object o) [0x00006] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at EventSystem+Entry.Invoke (System.Object data) [0x00040] in <7817ed9f41644b0a942e163651fe2d25>:0 
  at EventSystem.Trigger (UnityEngine.GameObject go, System.Int32 hash, System.Object data) [0x000bf] in <7817ed9f41644b0a942e163651fe2d25>:0 
  at EventExtensions.Trigger (UnityEngine.GameObject go, System.Int32 hash, System.Object data) [0x00020] in <7817ed9f41644b0a942e163651fe2d25>:0 
  at StarmapHexCellInventory.TransferAllItemsFromExternalInventory (StarmapHexCellInventory externalInventory) [0x00064] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at StarmapHexCellInventoryVisuals.OnSpawn () [0x00034] in <b528199c1fd84a39b3ce38acd7eb87b4>:0 
  at KMonoBehaviour.Spawn () [0x00078] in <7817ed9f41644b0a942e163651fe2d25>:0

I see that methods StarmapHexCellInventory.ExtractAndSpawnItemMass and StarmapHexCellInventory.ExtractAndStoreItemMass contain code for removing invalid items. But that's not enough.

Please add the code to remove invalid items in the StarmapHexCellInventory.OnDeserializedMethod method.

And or please add more null checks to the places where StarmapHexCellInventory.Items is used in combination with Assets.GetPrefab.
affected methods at the moment:
ArtifactHarvestModule.StatesInstance.CheckIfCanHarvest
ArtifactHarvestModule.StatesInstance.HarvestFromHexCell
ArtifactPOIStates.Instance.HasArtifactAvailableInHexCell
StarmapHexCellInventoryVisuals.RefreshVisuals

Test-Artifacts.sav


Steps to Reproduce

try loading the attached save file




User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

Changed Status to Fixed

Removing objects that don't exist in OnDeserializedMethod was sufficient to handle all cases. Thanks for including an example save.

  • Like 2
  • Thanks 1

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...