-
-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Description
If you right/left click on a pawn capacity in the medical tab while a pawn is still in transit (while dropping from a pod at the start of a game for instance), you get the following error:
Exception filling window for Fluffy.MainTabWindow_Medical: System.NullReferenceException: Object reference not set to an instance of an object
at Verse.RecipeDef+<PotentiallyMissingIngredients>d__70.MoveNext () [0x00049] in <a12d1ce36500429788a966a010bef562>:0
at System.Linq.Enumerable.Any[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00015] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at Fluffy.CapacityUtility.NotMissingVitalIngredient (Verse.Pawn pawn, Verse.RecipeDef r) [0x0000d] in <db939fcaabc049109dacf3c9cae7df6d>:0
at Fluffy.PawnColumnWorker_Capacity+<>c__DisplayClass7_0.<DoInteractions>b__0 (Verse.RecipeDef r) [0x0004d] in <db939fcaabc049109dacf3c9cae7df6d>:0
at System.Linq.Enumerable+WhereListIterator`1[TSource].MoveNext () [0x00037] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at Fluffy.PawnColumnWorker_Capacity.DoInteractions (UnityEngine.Rect rect, Verse.Pawn pawn, System.Single level) [0x0009b] in <db939fcaabc049109dacf3c9cae7df6d>:0
at Fluffy.PawnColumnWorker_Capacity.DoCell (UnityEngine.Rect rect, Verse.Pawn pawn, RimWorld.PawnTable table) [0x0009e] in <db939fcaabc049109dacf3c9cae7df6d>:0
at RimWorld.PawnTable.PawnTableOnGUI (UnityEngine.Vector2 position) [0x002a8] in <a12d1ce36500429788a966a010bef562>:0
at RimWorld.MainTabWindow_PawnTable.DoWindowContents (UnityEngine.Rect rect) [0x00027] in <a12d1ce36500429788a966a010bef562>:0
at Fluffy.MainTabWindow_Medical.DoWindowContents (UnityEngine.Rect rect) [0x00052] in <db939fcaabc049109dacf3c9cae7df6d>:0
at Verse.Window.InnerWindowOnGUI (System.Int32 x) [0x00165] in <a12d1ce36500429788a966a010bef562>:0
Verse.Log:Error(String, Boolean)
Verse.Window:InnerWindowOnGUI(Int32)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle)
The cause is RecipeDef.PotentiallyMissingIngredients being passed a null map, since the pawn is still in transit. Your NotMissingVitalIngredient function being the first one to trigger it, and in fact checking for a null map there does prevent the bug, in the current code at least. It would be safer to check the map in all functions using it though.
Edit: This bug possibly exists in the 1.0 version as well, but I haven't tested it there to confirm.