From 3918b29e30ec7d65dba3709852406d2e32a06470 Mon Sep 17 00:00:00 2001 From: Lacyway <20912169+Lacyway@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:07:46 +0200 Subject: [PATCH] Fix null ref in ItemContext_Patch --- Fika.Core/Coop/Players/ObservedCoopPlayer.cs | 1 + Fika.Core/UI/Patches/ItemContext_Patch.cs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Fika.Core/Coop/Players/ObservedCoopPlayer.cs b/Fika.Core/Coop/Players/ObservedCoopPlayer.cs index 3b50d7cc..affb5345 100644 --- a/Fika.Core/Coop/Players/ObservedCoopPlayer.cs +++ b/Fika.Core/Coop/Players/ObservedCoopPlayer.cs @@ -19,6 +19,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using UnityEngine; using static Fika.Core.Networking.FikaSerialization; diff --git a/Fika.Core/UI/Patches/ItemContext_Patch.cs b/Fika.Core/UI/Patches/ItemContext_Patch.cs index a04687a5..818184d2 100644 --- a/Fika.Core/UI/Patches/ItemContext_Patch.cs +++ b/Fika.Core/UI/Patches/ItemContext_Patch.cs @@ -32,7 +32,7 @@ private static void Prefix(ItemInfoInteractionsAbstractClass co return; } - ItemContextAbstractClass itemContext = Traverse.Create(contextInteractions).Field("gclass2828_0").Value; + ItemContextAbstractClass itemContext = Traverse.Create(contextInteractions).Field("gclass2829_0").Value; if (itemContext.ViewType == EItemViewType.Inventory) { if (Singleton.Instantiated && Singleton.Instance is not HideoutGameWorld) @@ -54,7 +54,9 @@ private static void Prefix(ItemInfoInteractionsAbstractClass co return; } - Dictionary dynamicInteractions = Traverse.Create(contextInteractions).Field>("dictionary_0").Value; + // Check for GClass increments + Dictionary dynamicInteractions = Traverse.Create(contextInteractions) + .Field>("dictionary_0").Value; if (dynamicInteractions == null) { dynamicInteractions = [];