Skip to content

Commit

Permalink
Fix exception when loading adjacency with empty source or target (#1859
Browse files Browse the repository at this point in the history
…) #patch

Sentry event ID: 08db0b07237b4437a57493f62363e30e
  • Loading branch information
IhateTrains authored Mar 30, 2024
1 parent c53356b commit f4fc5b6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ImperatorToCK3/CommonUtils/Map/MapData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,12 @@ private void LoadAdjacencies(string adjacenciesFilename, ModFilesystem modFS) {
if (toStr == "-1") {
continue;
}

AddAdjacency(ulong.Parse(fromStr, CultureInfo.InvariantCulture), ulong.Parse(toStr, CultureInfo.InvariantCulture));

if (!ulong.TryParse(fromStr, out var from) || !ulong.TryParse(toStr, out var to)) {
continue;
}

AddAdjacency(from, to);
++count;
}
}
Expand Down

0 comments on commit f4fc5b6

Please sign in to comment.