Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion SaintCoinach.Cmd/Commands/MapCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down