add check as this can come in as jsonElement for a reason

This commit is contained in:
CWX
2025-01-23 14:50:28 +00:00
parent 0b1da5c956
commit 176c7ab8cf
+10 -2
View File
@@ -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? itemLocation;
if (item.Location is JsonElement)
{
itemLocation = ((JsonElement)item.Location).ToObject<ItemLocation>();
}
else
{
itemLocation = (ItemLocation)item.Location;
}
if (itemLocation is null)
{
// item has no location property