Add logging to SharedStorageSystem prototype indexing failure (#29273)

This commit is contained in:
Tayrtahn
2024-06-20 20:16:43 -04:00
committed by GitHub
parent 831d962e5a
commit 0b3459268a

View File

@@ -1384,7 +1384,12 @@ public abstract class SharedStorageSystem : EntitySystem
// 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;