erdelf / AlienRaces

Rimworld mod alien race framework
MIT License
103 stars 69 forks source link

NRE in AlienRace.HarmonyPatches.ThoughtsFromIngestingPostfix when forming a caravan #67

Closed Taranchuk closed 1 year ago

Taranchuk commented 2 years ago

Upon forming a caravan, I'm getting this error. Seems to be breaking best food and medicine selection.

Exception filling window for RimWorld.Dialog_FormCaravan: System.NullReferenceException: Object reference not set to an instance of an object
  at (wrapper dynamic-method) AlienRace.HarmonyPatches.AlienRace.HarmonyPatches.ThoughtsFromIngestingPostfix_Patch0(Verse.Pawn,Verse.Thing,Verse.ThingDef,System.Collections.Generic.List`1<RimWorld.FoodUtility/ThoughtFromIngesting>&)
  at (wrapper dynamic-method) RimWorld.FoodUtility.RimWorld.FoodUtility.ThoughtsFromIngesting_Patch3(Verse.Pawn,Verse.Thing,Verse.ThingDef)
  at RimWorld.FoodUtility.WillGiveNegativeThoughts (Verse.Thing food, Verse.Pawn pawn) [0x00009] in <e7d5f5de1a9341908a67f5d958d8aaef>:0 
  at (wrapper dynamic-method) RimWorld.Dialog_FormCaravan.RimWorld.Dialog_FormCaravan.GetFoodScore_Patch0(RimWorld.Dialog_FormCaravan,Verse.Pawn,Verse.Thing,System.Collections.Generic.List`1<Verse.Pair`2<int, int>>)
  at RimWorld.Dialog_FormCaravan.BestFoodItemFor (Verse.Pawn pawn, System.Collections.Generic.IEnumerable`1[T] food, System.Collections.Generic.List`1[T] ticksToArrive) [0x00041] in <e7d5f5de1a9341908a67f5d958d8aaef>:0 
  at (wrapper dynamic-method) RimWorld.Dialog_FormCaravan.RimWorld.Dialog_FormCaravan.SelectApproximateBestTravelSupplies_Patch0(RimWorld.Dialog_FormCaravan)
  at (wrapper dynamic-method) RimWorld.Dialog_FormCaravan.RimWorld.Dialog_FormCaravan.CountToTransferChanged_Patch1(RimWorld.Dialog_FormCaravan)
  at (wrapper dynamic-method) RimWorld.Dialog_FormCaravan.RimWorld.Dialog_FormCaravan.DoWindowContents_Patch2(RimWorld.Dialog_FormCaravan,UnityEngine.Rect)
  at Verse.Window.InnerWindowOnGUI (System.Int32 x) [0x001ce] in <e7d5f5de1a9341908a67f5d958d8aaef>:0 
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) Verse.Log:Verse.Log.Error_Patch4 (string)
Verse.Window:InnerWindowOnGUI (int)
UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)

Hugslib log here: https://gist.github.com/HugsLibRecordKeeper/705ab46bc25be763a3c6b9fa5170c8cd

heatherathebyne commented 2 years ago

@erdelf This is possibly because ingester may not have a story at https://github.com/erdelf/AlienRaces/blob/master/Source/AlienRace/AlienRace/HarmonyPatches.cs#L2211 . Appears to only be when ingester is an animal.