diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index f20e2f9ab1f2cd..2b434befe5399c 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -1384,7 +1384,12 @@ public ItemSizePrototype GetMaxItemSize(Entity uid) // If we specify a max item size, use that if (uid.Comp.MaxItemSize != null) - return _prototype.Index(uid.Comp.MaxItemSize.Value); + { + if (_prototype.TryIndex(uid.Comp.MaxItemSize.Value, out var proto)) + return proto; + + Log.Error($"{ToPrettyString(uid.Owner)} tried to get invalid item size prototype: {uid.Comp.MaxItemSize.Value}. Stack trace:\\n{Environment.StackTrace}"); + } if (!_itemQuery.TryGetComponent(uid, out var item)) return _defaultStorageMaxItemSize;