diff --git a/Content.Server/Administration/Commands/SetAdminOOC.cs b/Content.Server/Administration/Commands/SetAdminOOC.cs index f889ddc15d..d2087f2b57 100644 --- a/Content.Server/Administration/Commands/SetAdminOOC.cs +++ b/Content.Server/Administration/Commands/SetAdminOOC.cs @@ -28,8 +28,7 @@ namespace Content.Server.Administration.Commands if (string.IsNullOrEmpty(colorArg)) return; - var color = Color.TryFromHex(colorArg); - if (!color.HasValue) + if (!Color.TryFromHex(colorArg, out var color)) { shell.WriteError(Loc.GetString("shell-invalid-color-hex")); return; @@ -37,10 +36,10 @@ namespace Content.Server.Administration.Commands var userId = shell.Player.UserId; // Save the DB - _dbManager.SaveAdminOOCColorAsync(userId, color.Value); + _dbManager.SaveAdminOOCColorAsync(userId, color); // Update the cached preference var prefs = _preferenceManager.GetPreferences(userId); - prefs.AdminOOCColor = color.Value; + prefs.AdminOOCColor = color; } } } diff --git a/Content.Server/Sandbox/Commands/ColorNetworkCommand.cs b/Content.Server/Sandbox/Commands/ColorNetworkCommand.cs index 98e72b6a05..a7e3efb083 100644 --- a/Content.Server/Sandbox/Commands/ColorNetworkCommand.cs +++ b/Content.Server/Sandbox/Commands/ColorNetworkCommand.cs @@ -56,14 +56,13 @@ namespace Content.Server.Sandbox.Commands return; } - var color = Color.TryFromHex(args[2]); - if (!color.HasValue) + if (!Color.TryFromHex(args[2], out var color)) { shell.WriteError(Loc.GetString("shell-invalid-color-hex")); return; } - PaintNodes(nodeContainerComponent, nodeGroupId, color.Value); + PaintNodes(nodeContainerComponent, nodeGroupId, color); } private void PaintNodes(NodeContainerComponent nodeContainerComponent, NodeGroupID nodeGroupId, Color color)