From 5257decfa3e3ce0d8cf30846faaed490e87a8b07 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Tue, 24 Dec 2024 08:56:45 -0600 Subject: [PATCH] fix ArgumentOutOfRangeException with sepia colors --- src/render/SepiaRenderer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/render/SepiaRenderer.cs b/src/render/SepiaRenderer.cs index 3daff45..1650141 100644 --- a/src/render/SepiaRenderer.cs +++ b/src/render/SepiaRenderer.cs @@ -3,8 +3,12 @@ public class SepiaRenderer : Renderer { public static bool IsWater(int? id) => id == null || LiveMap.Api.SepiaColors.BlockIsWater[(int)id]; public static byte GetIndex(int id) => LiveMap.Api.SepiaColors.Block2Color[id]; - public static uint GetColor(int index) => LiveMap.Api.SepiaColors.ColorsByCode.GetValueAtIndex(index); public static uint GetColor(string id) => LiveMap.Api.SepiaColors.ColorsByCode[id]; + public static uint GetColor(int index) { + return index >= 0 && index < LiveMap.Api.SepiaColors.ColorsByCode.Count + ? LiveMap.Api.SepiaColors.ColorsByCode.GetValueAtIndex(index) + : GetColor("ocean"); + } public SepiaRenderer() : base("sepia") { }