From 0b3459268ae445eefeaec11b81baf152b5d3dc6e Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Thu, 20 Jun 2024 20:16:43 -0400 Subject: [PATCH] Add logging to SharedStorageSystem prototype indexing failure (#29273) --- .../Storage/EntitySystems/SharedStorageSystem.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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;