pardeike/Zombieland

VFE:M mechs having a gizmo error

MagikTriple7 opened this issue · 9 comments

I found a (hopefully slight) compatibility bug with Zombieland and the buildable mechs from Vanilla Factions Expanded Mechanoids, specifically the ones that can be drafted to fight. Interpreting stacktrace, it just seems to be an issue with how the Gizmos are being handled, and Zombieland adds a few.

System.NullReferenceException: Object reference not set to an instance of an object
at Verse.GizmoGridDrawer+<>c.<.

It probably stems from the mechs not being either pawn or biotech mech, but rather a third secret thing.

I completely stumbled on this by random chance, and the bug goes away without Zombieland. I can drop some images and the full trace on request.

A stacktrace and a minimal reproducible example would be nice.

Here is the full stacktrace, I am working on getting a reproducible example at the moment.

System.InvalidOperationException: Failed to compare two elements in the array. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Verse.GizmoGridDrawer+<>c.<.cctor>b__13_0 (Verse.Gizmo lhs, Verse.Gizmo rhs) [0x00007] in <95de19971c5d40878d8742747904cdcd>:0
at Verse.GenCollection+<>c__DisplayClass33_01[T].<SortStable>b__0 (Verse.Pair2[T1,T2] lhs, Verse.Pair2[T1,T2] rhs) [0x00014] in <95de19971c5d40878d8742747904cdcd>:0 at System.Collections.Generic.ArraySortHelper1[T].PickPivotAndPartition (T[] keys, System.Int32 lo, System.Int32 hi, System.Comparison1[T] comparer) [0x00052] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.ArraySortHelper1[T].IntroSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Int32 depthLimit, System.Comparison1[T] comparer) [0x00069] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.ArraySortHelper1[T].IntrospectiveSort (T[] keys, System.Int32 left, System.Int32 length, System.Comparison1[T] comparer) [0x00015] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.ArraySortHelper1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison1[T] comparer) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0 --- End of inner exception stack trace --- at System.Collections.Generic.ArraySortHelper1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison1[T] comparer) [0x00020] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.List1[T].Sort (System.Comparison1[T] comparison) [0x00012] in <eae584ce26bc40229c1b1aa476bfa589>:0 at Verse.GenCollection.SortStable[T] (System.Collections.Generic.IList1[T] list, System.Func3[T1,T2,TResult] comparator) [0x0006e] in <95de19971c5d40878d8742747904cdcd>:0 at Verse.GizmoGridDrawer.DrawGizmoGrid (System.Collections.Generic.IEnumerable1[T] gizmos, System.Single startX, Verse.Gizmo& mouseoverGizmo, System.Func2[T,TResult] customActivatorFunc, System.Func2[T,TResult] highlightFunc, System.Func2[T,TResult] lowlightFunc) [0x00026] in <95de19971c5d40878d8742747904cdcd>:0 at (wrapper dynamic-method) RimWorld.InspectGizmoGrid.RimWorld.InspectGizmoGrid.DrawInspectGizmoGridFor_Patch0(System.Collections.Generic.IEnumerable1,Verse.Gizmo&) currentSelectable: null
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) Verse.Log:Verse.Log.Error_Patch1 (string)
Verse.Log:ErrorOnce (string,int)
(wrapper dynamic-method) RimWorld.InspectGizmoGrid:RimWorld.InspectGizmoGrid.DrawInspectGizmoGridFor_Patch0 (System.Collections.Generic.IEnumerable`1,Verse.Gizmo&)
RimWorld.MainTabWindow_Inspect:DrawInspectGizmos ()
RimWorld.InspectPaneUtility:ExtraOnGUI (RimWorld.IInspectPane)
RimWorld.MainTabWindow_Inspect:ExtraOnGUI ()
Verse.WindowStack:WindowStackOnGUI ()
(wrapper dynamic-method) RimWorld.UIRoot_Play:RimWorld.UIRoot_Play.UIRootOnGUI_Patch1 (RimWorld.UIRoot_Play)
(wrapper dynamic-method) Verse.Root:Verse.Root.OnGUI_Patch1 (Verse.Root)

Yep got it reproduced on another machine. Modlist order is:

Harmony
Core
Royalty
Ideology
Biotech
Vanilla Expanded Framework
VFE Mechanoids
Zombieland

(testing if this image works)

20230714123808_1

Different computer stacktrace:

System.InvalidOperationException: Failed to compare two elements in the array. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Verse.GizmoGridDrawer+<>c.<.cctor>b__13_0 (Verse.Gizmo lhs, Verse.Gizmo rhs) [0x00000] in <95de19971c5d40878d8742747904cdcd>:0
at Verse.GenCollection+<>c__DisplayClass33_01[T].<SortStable>b__0 (Verse.Pair2[T1,T2] lhs, Verse.Pair2[T1,T2] rhs) [0x00014] in <95de19971c5d40878d8742747904cdcd>:0 at System.Collections.Generic.ArraySortHelper1[T].InsertionSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Comparison1[T] comparer) [0x0002a] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.ArraySortHelper1[T].IntroSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Int32 depthLimit, System.Comparison1[T] comparer) [0x0004b] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.ArraySortHelper1[T].IntrospectiveSort (T[] keys, System.Int32 left, System.Int32 length, System.Comparison1[T] comparer) [0x00015] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.ArraySortHelper1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison1[T] comparer) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0 --- End of inner exception stack trace --- at System.Collections.Generic.ArraySortHelper1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison1[T] comparer) [0x00020] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.List1[T].Sort (System.Comparison1[T] comparison) [0x00012] in <eae584ce26bc40229c1b1aa476bfa589>:0 at Verse.GenCollection.SortStable[T] (System.Collections.Generic.IList1[T] list, System.Func3[T1,T2,TResult] comparator) [0x0006e] in <95de19971c5d40878d8742747904cdcd>:0 at Verse.GizmoGridDrawer.DrawGizmoGrid (System.Collections.Generic.IEnumerable1[T] gizmos, System.Single startX, Verse.Gizmo& mouseoverGizmo, System.Func2[T,TResult] customActivatorFunc, System.Func2[T,TResult] highlightFunc, System.Func2[T,TResult] lowlightFunc) [0x00026] in <95de19971c5d40878d8742747904cdcd>:0 at RimWorld.InspectGizmoGrid.DrawInspectGizmoGridFor (System.Collections.Generic.IEnumerable1[T] selectedObjects, Verse.Gizmo& mouseoverGizmo) [0x0017a] in <95de19971c5d40878d8742747904cdcd>:0 currentSelectable: null
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.Log:ErrorOnce (string,int)
RimWorld.InspectGizmoGrid:DrawInspectGizmoGridFor (System.Collections.Generic.IEnumerable`1,Verse.Gizmo&)
RimWorld.MainTabWindow_Inspect:DrawInspectGizmos ()
RimWorld.InspectPaneUtility:ExtraOnGUI (RimWorld.IInspectPane)
RimWorld.MainTabWindow_Inspect:ExtraOnGUI ()
Verse.WindowStack:WindowStackOnGUI ()
RimWorld.UIRoot_Play:UIRootOnGUI ()
Verse.Root:OnGUI ()

Sorry but there is no mod called "VFE Mechanoids" and I am not guessing which of the 20 mods that start with "VFE Mechanoids..." is the one you are usiing. Can you upload a minimal save game so I can use RimPy to sub to the right mods?

I don't see how the stacktrace is related to Zombieland. You said that removing Zombieland "fixes" this but it could equally well be another side effect from starting Rimworld.

Yeah sure. I just naturally abbreviate Vanilla Factions Expanded: Mechanoids to VFEM.

(testing upload)

RW test map.zip

I relate the stacktrace to the gizmos that Zombieland adds to colonists, as when Zombieland is not installed, the mechanoids work fine and can be used as intended.

Ah, the save game helped. I have fixed the problem (you shall not return null for gizmos. It usually works until the game wants to sort all gizmos at which point you will get a NRE. I am now avoiding to yield a null gizmo. Fixed in the next release (4.2.1)

Yay! Thank you for fixing this, considering I am probably the only person on the planet who has ran into this issue ever. I should really pick different hobbies that do not involve niche modding communities (cough cough Minecraft cough cough).

Any hint to when this update should release?

Again thank you for this.

Already released