bounds checks

This commit is contained in:
Az committed 2026-10-01 01:50:39 -04:00
1 parent c2c7c63b9b
commit 2e212dee47
2 files changed
+12

No files matched your search

+3
View File
@@ -95,3 +95,6 @@ dotnet_diagnostic.S1244.severity = none
# IDE0045: Convert to conditional expression
dotnet_diagnostic.IDE0045.severity = none
# IDE0046: Convert to conditional expression
dotnet_diagnostic.IDE0046.severity = none
+9
View File
@@ -45,6 +45,9 @@ public static class PaletteManager
/// <returns><c>true</c> if the color is a variable color; <c>false</c> otherwise.</returns>
public static bool IsVariable(int colorId)
{
if (colorId < 0 || colorId >= Palette.ColorNames.Length)
return false;
return VariableColorNames.Contains(Palette.ColorNames[colorId]);
}
@@ -65,6 +68,9 @@ public static class PaletteManager
/// <returns>The main color associated with the provided ID.</returns>
public static Color GetMainColor(int colorId)
{
if (colorId < 0 || colorId >= Palette.ColorNames.Length)
return Color.white;
return !ColorIdToColorMap.TryGetValue(colorId, out var custom)
? Palette.PlayerColors[colorId]
: (custom is VariableColor variable
@@ -79,6 +85,9 @@ public static class PaletteManager
/// <returns>The shadow color associated with the provided ID.</returns>
public static Color GetShadowColor(int colorId)
{
if (colorId < 0 || colorId >= Palette.ColorNames.Length)
return Color.white;
return !ColorIdToColorMap.TryGetValue(colorId, out var custom)
? Palette.ShadowColors[colorId]
: (custom is VariableColor variable