diff --git a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs
index 54fc35d8..2a66ae07 100644
--- a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs
+++ b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs
@@ -798,8 +798,8 @@ public class InventoryHelper(
///
/// Get a 2d mapping of a container with what grid slots are filled
///
- /// Horizontal size of container
- /// Vertical size of container
+ /// Horizontal size of container
+ /// Vertical size of container
/// Players inventory items
/// Id of the container
/// Two-dimensional representation of container
@@ -822,18 +822,19 @@ public class InventoryHelper(
foreach (var item in containerItemHash)
{
ItemLocation? itemLocation;
- if (item.Location is JsonElement)
+ if (item.Location is JsonElement element)
{
- itemLocation = ((JsonElement) item.Location).ToObject();
+ // TODO: is this ever true?
+ itemLocation = element.ToObject();
}
else
{
- itemLocation = (ItemLocation) item.Location;
+ itemLocation = (ItemLocation?) item.Location;
}
if (itemLocation is null)
{
- // item has no location property
+ // Item has no location property
_logger.Error($"Unable to find 'location' property on item with id: {item.Id}, skipping");
continue;
@@ -854,7 +855,7 @@ public class InventoryHelper(
try
{
var rowIndex = itemLocation.Y + y;
- var containerX = containerYX[rowIndex.Value];
+ var containerX = containerYX.ElementAtOrDefault(rowIndex.Value);
if (containerX is null)
{
_logger.Error($"Unable to find container: {containerId} row line: {itemLocation.Y + y}");