diff --git a/ImperatorToCK3/Imperator/Provinces/ProvinceFactory.cs b/ImperatorToCK3/Imperator/Provinces/ProvinceFactory.cs index cdcc0bc1e..f1c1531b6 100644 --- a/ImperatorToCK3/Imperator/Provinces/ProvinceFactory.cs +++ b/ImperatorToCK3/Imperator/Provinces/ProvinceFactory.cs @@ -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);