Skip to content

NullReferenceException when caravan enters base #50

@tobi1449

Description

@tobi1449

I get the following exception when I try to enter my base with a caravan:

Exception filling window for Verse.FloatMenuWorld: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at AwesomeInventory.Loadout.CompAwesomeInventoryLoadout+<>c__DisplayClass48_0.<ChangeCostume>g__StartUndressJobs|0 (System.Collections.Generic.IEnumerable`1[T] apparels, Verse.Pawn pawn) [0x00008] in <808a267935e34741873c701036871b19>:0 
  at AwesomeInventory.Loadout.CompAwesomeInventoryLoadout.ChangeCostume (AwesomeInventory.Loadout.AwesomeInventoryLoadout newLoadout, AwesomeInventory.Loadout.AwesomeInventoryLoadout oldLoadout, System.Boolean delay, System.Boolean keepCache) [0x00109] in <808a267935e34741873c701036871b19>:0 
  at AwesomeInventory.Loadout.CompAwesomeInventoryLoadout.UpdateForNewLoadout (AwesomeInventory.Loadout.AwesomeInventoryLoadout newLoadout, System.Boolean delay, System.Boolean respawn, System.Boolean forced) [0x00108] in <808a267935e34741873c701036871b19>:0 
  at AwesomeInventory.Loadout.CompAwesomeInventoryLoadout.PostSpawnSetup (System.Boolean respawningAfterLoad) [0x00035] in <808a267935e34741873c701036871b19>:0 
  at Verse.ThingWithComps.SpawnSetup (Verse.Map map, System.Boolean respawningAfterLoad) [0x00020] in <d72310b4d8f64d25aee502792b58549f>:0 
  at (wrapper dynamic-method) Verse.Pawn.Verse.Pawn.SpawnSetup_Patch1(Verse.Pawn,Verse.Map,bool)
  at (wrapper dynamic-method) Verse.GenSpawn.Verse.GenSpawn.Spawn_Patch4(Verse.Thing,Verse.IntVec3,Verse.Map,Verse.Rot4,Verse.WipeMode,bool)
  at (wrapper dynamic-method) RimWorld.Planet.CaravanEnterMapUtility.RimWorld.Planet.CaravanEnterMapUtility.Enter_Patch1(RimWorld.Planet.Caravan,Verse.Map,System.Func`2<Verse.Pawn, Verse.IntVec3>,RimWorld.Planet.CaravanDropInventoryMode,bool)
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <567df3e0919241ba98db88bec4c6696f>:0 
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 
  at TerrainMovement.CaravanEnterMapUtility_Enter_Patch.Prefix (RimWorld.Planet.Caravan caravan, Verse.Map map, RimWorld.Planet.CaravanEnterMode enterMode, RimWorld.Planet.CaravanDropInventoryMode dropInventoryMode, System.Boolean draftColonists, System.Predicate`1[T] extraCellValidator) [0x000da] in <4e522841ea88412295009cbddbce23dd>:0 
  at (wrapper dynamic-method) RimWorld.Planet.CaravanEnterMapUtility.RimWorld.Planet.CaravanEnterMapUtility.Enter_Patch1(RimWorld.Planet.Caravan,Verse.Map,RimWorld.Planet.CaravanEnterMode,RimWorld.Planet.CaravanDropInventoryMode,bool,System.Predicate`1<Verse.IntVec3>)
  at RimWorld.Planet.CaravanArrivalAction_Enter.Arrived (RimWorld.Planet.Caravan caravan) [0x000b8] in <d72310b4d8f64d25aee502792b58549f>:0 
  at RimWorld.Planet.CaravanArrivalActionUtility+<>c__DisplayClass0_0`1[T].<GetFloatMenuOptions>b__2 () [0x00041] in <d72310b4d8f64d25aee502792b58549f>:0 
  at Verse.FloatMenuOption.Chosen (System.Boolean colonistOrdering, Verse.FloatMenu floatMenu) [0x00028] in <d72310b4d8f64d25aee502792b58549f>:0 
  at (wrapper dynamic-method) Verse.FloatMenuOption.Verse.FloatMenuOption.DoGUI_Patch1(Verse.FloatMenuOption,UnityEngine.Rect,bool,Verse.FloatMenu)
  at Verse.FloatMenu.DoWindowContents (UnityEngine.Rect rect) [0x000fb] in <d72310b4d8f64d25aee502792b58549f>:0 
  at Verse.FloatMenuWorld.DoWindowContents (UnityEngine.Rect inRect) [0x0009b] in <d72310b4d8f64d25aee502792b58549f>:0 
  at Verse.Window.InnerWindowOnGUI (System.Int32 x) [0x00165] in <d72310b4d8f64d25aee502792b58549f>:0 

Looks like you missed a few null checks for _pawn.jobs in CompAwesomeInventoryLoadout.ChangeCostume().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions