From 37d81284cb4fcda9aabdb4e831f4121cf9e9f31b Mon Sep 17 00:00:00 2001 From: haven1433 Date: Wed, 10 Jul 2024 18:14:22 -0500 Subject: [PATCH] guard code for FindMacro --- src/HexManiac.Core/Models/PCSString.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/HexManiac.Core/Models/PCSString.cs b/src/HexManiac.Core/Models/PCSString.cs index f9687ad5..fc4eef20 100644 --- a/src/HexManiac.Core/Models/PCSString.cs +++ b/src/HexManiac.Core/Models/PCSString.cs @@ -64,12 +64,6 @@ namespace HavenSoft.HexManiac.Core.Models { public static class PCSString { private const string TextReferenceFileName = "resources/pcsReference.txt"; - public static IReadOnlyList PCS; - public static IReadOnlySet ValidInProgressEscapes; - public static IReadOnlyList Newlines; - public static IReadOnlyDictionary ControlCodeLengths; - public static IReadOnlyDictionary> TextMacros; - public static IReadOnlyDictionary>> TextMacrosIndex; public static readonly byte DynamicEscape = 0xF7; public static readonly byte FunctionEscape = 0xFC; @@ -581,6 +575,7 @@ namespace HavenSoft.HexManiac.Core.Models { } private static string FindMacro(IReadOnlyList> macrosIndex, IReadOnlyList data, int index) { + if (!index.InRange(0, data.Count)) return null; var macros = macrosIndex[data[index]]; if (macros == null) return null; foreach (var kvp in macros) {