Caves of Qud

Caves of Qud

Show Weapon, Item Stats
falleng0d 2024 年 12 月 25 日 上午 10:53
Error when opening inventory (Update: 25 Dec @ 5:30am)
Since the last update I am getting the following and am unable to open my inventory:

RunSegment: System.AggregateException: One or more errors occurred. (Failed to compare two elements in the array.) ---> System.InvalidOperationException: Failed to compare two elements in the array. ---> System.NullReferenceException: Object reference not set to an instance of an object
at BCL.SWIS_HarmonyPatch.LiquidVolume_Patch.LiquidVolumePostFix (XRL.World.GetDisplayNameEvent E, System.Boolean& __result, XRL.World.Parts.LiquidVolume __instance) [0x0017f] in E:\SteamLibrary\steamapps\workshop\content\333640\3371639487\Energy_Patch.cs:180
at (wrapper dynamic-method) XRL.World.Parts.LiquidVolume.XRL.World.Parts.LiquidVolume.HandleEvent_Patch1(XRL.World.Parts.LiquidVolume,XRL.World.GetDisplayNameEvent)
at XRL.World.GetDisplayNameEvent.Dispatch (XRL.IEventHandler Handler) [0x00000] in <92095d38a1a94620890943b3fa8613ab>:0
at XRL.World.GameObject.HandleEventInner (XRL.World.MinEvent E) [0x0007d] in <92095d38a1a94620890943b3fa8613ab>:0
at (wrapper dynamic-method) XRL.World.GameObject.XRL.World.GameObject.HandleEvent_Patch2(XRL.World.GameObject,XRL.World.MinEvent)
at XRL.World.GetDisplayNameEvent.ProcessFor (XRL.World.GameObject obj, System.Boolean NoReturn) [0x00000] in <92095d38a1a94620890943b3fa8613ab>:0
at XRL.World.GetDisplayNameEvent.GetFor (XRL.World.GameObject Object, System.String Base, System.Int32 Cutoff, System.String Context, System.Boolean AsIfKnown, System.Boolean Single, System.Boolean NoConfusion, System.Boolean NoColor, System.Boolean ColorOnly, System.Boolean Visible, System.Boolean BaseOnly, System.Boolean UsingAdjunctNoun, System.Boolean WithoutTitles, System.Boolean ForSort, System.Boolean Reference, System.Boolean IncludeImplantPrefix) [0x000cd] in <92095d38a1a94620890943b3fa8613ab>:0
at XRL.World.GameObject.get_DisplayName () [0x00007] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.InventoryLineData.get_displayName () [0x00008] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.InventoryAndEquipmentStatusScreen+<>c.<UpdateViewFromData>b__35_11 (Qud.UI.InventoryLineData a, Qud.UI.InventoryLineData b) [0x00000] in <92095d38a1a94620890943b3fa8613ab>:0
at System.Collections.Generic.ArraySortHelper`1[T].InsertionSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Comparison`1[T] comparer) [0x0002a] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Collections.Generic.ArraySortHelper`1[T].IntroSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Int32 depthLimit, System.Comparison`1[T] comparer) [0x0004b] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Collections.Generic.ArraySortHelper`1[T].IntrospectiveSort (T[] keys, System.Int32 left, System.Int32 length, System.Comparison`1[T] comparer) [0x00013] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) [0x00000] in <c0b7b90d34a54066a7234dad69255116>:0
--- End of inner exception stack trace ---
at System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) [0x00023] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Collections.Generic.List`1[T].Sort (System.Comparison`1[T] comparison) [0x00013] in <c0b7b90d34a54066a7234dad69255116>:0
at Qud.UI.InventoryAndEquipmentStatusScreen.UpdateViewFromData () [0x004d6] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.InventoryAndEquipmentStatusScreen.OnSearchTextChange (System.String text) [0x0002e] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.InventoryAndEquipmentStatusScreen.ShowScreen (XRL.World.GameObject GO, Qud.UI.StatusScreensScreen parent) [0x0019e] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.StatusScreensScreen.UpdateActiveScreen () [0x00209] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.StatusScreensScreen.SetupContexts () [0x002a1] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.StatusScreensScreen.UpdateViewFromData () [0x00005] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.StatusScreensScreen.showScreen (System.Int32 StartingScreen, XRL.World.GameObject GO) [0x0024b] in <92095d38a1a94620890943b3fa8613ab>:0
at XRL.UI.Framework.NavigationController.SuspendContextWhile[T] (System.Func`1[TResult] taskCreator) [0x000df] in <92095d38a1a94620890943b3fa8613ab>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Threading.Tasks.Task`1[TResult].get_Result () [0x0000f] in <c0b7b90d34a54066a7234dad69255116>:0
at XRL.UI.Screens.Show (XRL.World.GameObject GO) [0x0005f] in <92095d38a1a94620890943b3fa8613ab>:0
at (wrapper dynamic-method) XRL.Core.XRLCore.XRL.Core.XRLCore.PlayerTurn_Patch1(XRL.Core.XRLCore)
at XRL.Core.ActionManager.RunSegment () [0x01ec9] in <92095d38a1a94620890943b3fa8613ab>:0
---> (Inner Exception #0) System.InvalidOperationException: Failed to compare two elements in the array. ---> System.NullReferenceException: Object reference not set to an instance of an object
at BCL.SWIS_HarmonyPatch.LiquidVolume_Patch.LiquidVolumePostFix (XRL.World.GetDisplayNameEvent E, System.Boolean& __result, XRL.World.Parts.LiquidVolume __instance) [0x0017f] in E:\SteamLibrary\steamapps\workshop\content\333640\3371639487\Energy_Patch.cs:180
at (wrapper dynamic-method) XRL.World.Parts.LiquidVolume.XRL.World.Parts.LiquidVolume.HandleEvent_Patch1(XRL.World.Parts.LiquidVolume,XRL.World.GetDisplayNameEvent)
at XRL.World.GetDisplayNameEvent.Dispatch (XRL.IEventHandler Handler) [0x00000] in <92095d38a1a94620890943b3fa8613ab>:0
at XRL.World.GameObject.HandleEventInner (XRL.World.MinEvent E) [0x0007d] in <92095d38a1a94620890943b3fa8613ab>:0
at (wrapper dynamic-method) XRL.World.GameObject.XRL.World.GameObject.HandleEvent_Patch2(XRL.World.GameObject,XRL.World.MinEvent)
at XRL.World.GetDisplayNameEvent.ProcessFor (XRL.World.GameObject obj, System.Boolean NoReturn) [0x00000] in <92095d38a1a94620890943b3fa8613ab>:0
at XRL.World.GetDisplayNameEvent.GetFor (XRL.World.GameObject Object, System.String Base, System.Int32 Cutoff, System.String Context, System.Boolean AsIfKnown, System.Boolean Single, System.Boolean NoConfusion, System.Boolean NoColor, System.Boolean ColorOnly, System.Boolean Visible, System.Boolean BaseOnly, System.Boolean UsingAdjunctNoun, System.Boolean WithoutTitles, System.Boolean ForSort, System.Boolean Reference, System.Boolean IncludeImplantPrefix) [0x000cd] in <92095d38a1a94620890943b3fa8613ab>:0
at XRL.World.GameObject.get_DisplayName () [0x00007] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.InventoryLineData.get_displayName () [0x00008] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.InventoryAndEquipmentStatusScreen+<>c.<UpdateViewFromData>b__35_11 (Qud.UI.InventoryLineData a, Qud.UI.InventoryLineData b) [0x00000] in <92095d38a1a94620890943b3fa8613ab>:0
at System.Collections.Generic.ArraySortHelper`1[T].InsertionSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Comparison`1[T] comparer) [0x0002a] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Collections.Generic.ArraySortHelper`1[T].IntroSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Int32 depthLimit, System.Comparison`1[T] comparer) [0x0004b] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Collections.Generic.ArraySortHelper`1[T].IntrospectiveSort (T[] keys, System.Int32 left, System.Int32 length, System.Comparison`1[T] comparer) [0x00013] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) [0x00000] in <c0b7b90d34a54066a7234dad69255116>:0
--- End of inner exception stack trace ---
at System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) [0x00023] in <c0b7b90d34a54066a7234dad69255116>:0
at System.Collections.Generic.List`1[T].Sort (System.Comparison`1[T] comparison) [0x00013] in <c0b7b90d34a54066a7234dad69255116>:0
at Qud.UI.InventoryAndEquipmentStatusScreen.UpdateViewFromData () [0x004d6] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.InventoryAndEquipmentStatusScreen.OnSearchTextChange (System.String text) [0x0002e] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.InventoryAndEquipmentStatusScreen.ShowScreen (XRL.World.GameObject GO, Qud.UI.StatusScreensScreen parent) [0x0019e] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.StatusScreensScreen.UpdateActiveScreen () [0x00209] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.StatusScreensScreen.SetupContexts () [0x002a1] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.StatusScreensScreen.UpdateViewFromData () [0x00005] in <92095d38a1a94620890943b3fa8613ab>:0
at Qud.UI.StatusScreensScreen.showScreen (System.Int32 StartingScreen, XRL.World.GameObject GO) [0x0024b] in <92095d38a1a94620890943b3fa8613ab>:0
at XRL.UI.Framework.NavigationController.SuspendContextWhile[T] (System.Func`1[TResult] taskCreator) [0x000df] in <92095d38a1a94620890943b3fa8613ab>:0 <---
< >
正在显示第 1 - 5 条,共 5 条留言
falleng0d 2024 年 12 月 25 日 上午 11:05 
I added a null check and it seems to fix it:

starting on Energy_Patch.cs:174...

```c#
var liquidFueledPowerPlant = __instance.ParentObject.GetPart<LiquidFueledPowerPlant>();
var hasLiquidFueledPowerPlant = liquidFueledPowerPlant != null;

if (__instance.Volume == 0)
{
sb += "{{K|of " + __instance.ParentObject.GetPart<LiquidFueledEnergyCell>().Liquid;
// don't skip rest, even if current is 0, still shows max.
}
else
if (!__instance.IsPureLiquid() || !hasLiquidFueledPowerPlant ||!__instance.ContainsLiquid(liquidFueledPowerPlant.Liquid))
{
SWISFunctions.lmax = -1;
__result = true; return;
}
```
biocrystalluminescence  [开发者] 2024 年 12 月 25 日 上午 11:44 
oops, they're both supposed to be GetPart<LiquidFueledEnergyCell>, one second.

edit: update up.
最后由 biocrystalluminescence 编辑于; 2024 年 12 月 25 日 上午 11:55
gkns 2024 年 12 月 25 日 上午 11:47 
Same issue, similar fix:

if (!(__instance.ParentObject?.GetPart<LiquidFueledPowerPlant>() is { } powerPlant) ||
!__instance.IsPureLiquid() ||
!__instance.ContainsLiquid(powerPlant.Liquid))

Love the mod :)
biocrystalluminescence  [开发者] 2024 年 12 月 25 日 下午 12:08 
if that's line 261, that section is already inside of a 'if HasPart<LiquidFueledPowerPlant>', so it should be fine. is it not opening?

edit: oh same issue, not similar issue, my bad.
and thanks :)
最后由 biocrystalluminescence 编辑于; 2024 年 12 月 25 日 下午 12:19
gkns 2024 年 12 月 25 日 下午 12:13 
I changed line 180, but after changing back to the original code with LiquidFueledEnergyCell instead of LiquidFueledPowerPlant it works too.
< >
正在显示第 1 - 5 条,共 5 条留言
每页显示数: 1530 50