diff --git a/.editorconfig b/.editorconfig index d76679a102..3a7edd5f42 100644 --- a/.editorconfig +++ b/.editorconfig @@ -819,6 +819,9 @@ dotnet_diagnostic.CA2200.severity = warning # Initialize value type static fields inline. dotnet_diagnostic.CA2207.severity = warning +# Instantiate argument exceptions correctly. +dotnet_diagnostic.CA2208.severity = warning + # Dispose methods should call base class dispose. dotnet_diagnostic.CA2215.severity = warning diff --git a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs index 362646f77a..43a9deb8ad 100644 --- a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs @@ -263,11 +263,10 @@ namespace OpenRA.Mods.Common.Widgets case TextAlign.Left: return new int2(rb.X + LeftMargin, y); case TextAlign.Center: + default: return new int2(rb.X + (UsableWidth - textSize.X) / 2, y); case TextAlign.Right: return new int2(rb.X + UsableWidth - textSize.X - RightMargin, y); - default: - throw new ArgumentOutOfRangeException("Align"); } }