Fix admin verb PVS issue (#21406)
This commit is contained in:
@@ -24,16 +24,17 @@ namespace Content.Shared.Verbs
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
var target = GetEntity(args.Target);
|
||||
if (!TryGetEntity(args.Target, out var target))
|
||||
return;
|
||||
|
||||
// It is possible that client-side prediction can cause this event to be raised after the target entity has
|
||||
// been deleted. So we need to check that the entity still exists.
|
||||
if (Deleted(target) || Deleted(user))
|
||||
if (Deleted(user))
|
||||
return;
|
||||
|
||||
// Get the list of verbs. This effectively also checks that the requested verb is in fact a valid verb that
|
||||
// the user can perform.
|
||||
var verbs = GetLocalVerbs(target, user.Value, args.RequestedVerb.GetType());
|
||||
var verbs = GetLocalVerbs(target.Value, user.Value, args.RequestedVerb.GetType());
|
||||
|
||||
// Note that GetLocalVerbs might waste time checking & preparing unrelated verbs even though we know
|
||||
// precisely which one we want to run. However, MOST entities will only have 1 or 2 verbs of a given type.
|
||||
@@ -41,7 +42,7 @@ namespace Content.Shared.Verbs
|
||||
|
||||
// Find the requested verb.
|
||||
if (verbs.TryGetValue(args.RequestedVerb, out var verb))
|
||||
ExecuteVerb(verb, user.Value, target);
|
||||
ExecuteVerb(verb, user.Value, target.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user