mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Fix EntProtoId<T>.TryGet throwing an error on invalid prototype ids (#6349)
This commit is contained in:
@@ -107,8 +107,9 @@ public readonly record struct EntProtoId<T>(string Id) : IEquatable<string>, ICo
|
||||
|
||||
public bool TryGet([NotNullWhen(true)] out T? comp, IPrototypeManager? prototypes, IComponentFactory compFactory)
|
||||
{
|
||||
comp = default;
|
||||
prototypes ??= IoCManager.Resolve<IPrototypeManager>();
|
||||
var proto = prototypes.Index(this);
|
||||
return proto.TryGetComponent(out comp, compFactory);
|
||||
return prototypes.TryIndex(this, out var proto) &&
|
||||
proto.TryGetComponent(out comp, compFactory);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user