Replace ifs with ArgumentNullException.ThrowIfNull

This commit is contained in:
Dominion
2023-06-12 20:43:29 -04:00
parent 9303486b1e
commit 8af2ff539e
225 changed files with 530 additions and 1060 deletions
@@ -51,10 +51,8 @@ namespace Tgstation.Server.Host.Security
/// <inheritdoc />
public void CacheSystemIdentity(User user, ISystemIdentity systemIdentity, DateTimeOffset expiry)
{
if (user == null)
throw new ArgumentNullException(nameof(user));
if (systemIdentity == null)
throw new ArgumentNullException(nameof(systemIdentity));
ArgumentNullException.ThrowIfNull(user);
ArgumentNullException.ThrowIfNull(systemIdentity);
lock (cachedIdentities)
{
@@ -84,8 +82,7 @@ namespace Tgstation.Server.Host.Security
/// <inheritdoc />
public ISystemIdentity LoadCachedIdentity(User user)
{
if (user == null)
throw new ArgumentNullException(nameof(user));
ArgumentNullException.ThrowIfNull(user);
lock (cachedIdentities)
if (cachedIdentities.TryGetValue(user.Id.Value, out var identity))
return identity.SystemIdentity.Clone();