Skip to content

Commit

Permalink
Fix null ref in ItemContext_Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jun 14, 2024
1 parent f48d9d0 commit 3918b29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Fika.Core/Coop/Players/ObservedCoopPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions Fika.Core/UI/Patches/ItemContext_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private static void Prefix(ItemInfoInteractionsAbstractClass<EItemInfoButton> co
return;
}

ItemContextAbstractClass itemContext = Traverse.Create(contextInteractions).Field<ItemContextAbstractClass>("gclass2828_0").Value;
ItemContextAbstractClass itemContext = Traverse.Create(contextInteractions).Field<ItemContextAbstractClass>("gclass2829_0").Value;
if (itemContext.ViewType == EItemViewType.Inventory)
{
if (Singleton<GameWorld>.Instantiated && Singleton<GameWorld>.Instance is not HideoutGameWorld)
Expand All @@ -54,7 +54,9 @@ private static void Prefix(ItemInfoInteractionsAbstractClass<EItemInfoButton> co
return;
}

Dictionary<string, DynamicInteractionClass> dynamicInteractions = Traverse.Create(contextInteractions).Field<Dictionary<string, DynamicInteractionClass>>("dictionary_0").Value;
// Check for GClass increments
Dictionary<string, DynamicInteractionClass> dynamicInteractions = Traverse.Create(contextInteractions)
.Field<Dictionary<string, DynamicInteractionClass>>("dictionary_0").Value;
if (dynamicInteractions == null)
{
dynamicInteractions = [];
Expand Down

0 comments on commit 3918b29

Please sign in to comment.