From 176c7ab8cf36a5d94232e6052b8c539c8202f29b Mon Sep 17 00:00:00 2001 From: CWX Date: Thu, 23 Jan 2025 14:50:28 +0000 Subject: [PATCH] add check as this can come in as jsonElement for a reason --- Libraries/Core/Helpers/InventoryHelper.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Libraries/Core/Helpers/InventoryHelper.cs b/Libraries/Core/Helpers/InventoryHelper.cs index 7aa95f9a..6cda24c1 100644 --- a/Libraries/Core/Helpers/InventoryHelper.cs +++ b/Libraries/Core/Helpers/InventoryHelper.cs @@ -770,8 +770,16 @@ public class InventoryHelper( // Check each item in container foreach (var item in containerItemHash) { - var location = (JsonElement)item.Location; - var itemLocation = location.ToObject(); + ItemLocation? itemLocation; + if (item.Location is JsonElement) + { + itemLocation = ((JsonElement)item.Location).ToObject(); + } + else + { + itemLocation = (ItemLocation)item.Location; + } + if (itemLocation is null) { // item has no location property