Skip to content

Commit

Permalink
Don't throw exception on province beloning to an unloaded state (#1527)…
Browse files Browse the repository at this point in the history
… #patch
  • Loading branch information
IhateTrains authored Sep 24, 2023
1 parent ca554e2 commit 08f3a7d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ImperatorToCK3/Imperator/Provinces/ProvinceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ public static Province Parse(BufferedReader reader, ulong provinceId, StateColle
provinceParser.ParseStream(reader);

if (parsedStateId is not null) {
parsedProvince.State = states[parsedStateId.Value];
if (!states.TryGetValue(parsedStateId.Value, out var state)) {
Logger.Warn($"Province {parsedProvince.Id} has state ID {parsedStateId}, but no such state has been loaded!");
} else {
parsedProvince.State = state;
}
}

parsedProvince.TryLinkOwnerCountry(parsedOwnerId, countries);
Expand Down

0 comments on commit 08f3a7d

Please sign in to comment.