From f99d69c2cf7762bdaf5d980b3741339aaf56c406 Mon Sep 17 00:00:00 2001 From: JayDeezus <47218690+JayDeezus@users.noreply.github.com> Date: Sat, 7 Jun 2025 07:14:21 -0700 Subject: [PATCH] Update MapCommand.cs added a workaround to continue processing maps when map.TerritoryType would throw an exception. --- SaintCoinach.Cmd/Commands/MapCommand.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/SaintCoinach.Cmd/Commands/MapCommand.cs b/SaintCoinach.Cmd/Commands/MapCommand.cs index c8d1a040..888a69c7 100644 --- a/SaintCoinach.Cmd/Commands/MapCommand.cs +++ b/SaintCoinach.Cmd/Commands/MapCommand.cs @@ -48,7 +48,19 @@ public override async Task InvokeAsync(string[] paramList) { outPathSb.AppendFormat("{0}/{1}", map.Id.ToString().Split('/')[0], map.Id.ToString().Replace("/", ".")); outPathSb.Append(FormatToExtension(format)); } else { - var territoryName = map.TerritoryType?.Name?.ToString(); + // this line is occasionally throwing an exception at map.TerritoryType + //var territoryName = map.TerritoryType?.Name?.ToString(); + + // I wrapped the line in a try/catch just to have the loop continue to process other maps when it encounters an exception. + string territoryName = ""; + try { + territoryName = map.TerritoryType?.Name?.ToString(); + } + catch (Exception ex) { + OutputError($"Error processing map {map.Id}: {ex.Message}"); + continue; + } + if (!string.IsNullOrEmpty(territoryName)) { if (territoryName.Length < 3) { outPathSb.AppendFormat("{0}/", territoryName);