diff --git a/ImperatorToCK3/Imperator/Provinces/ProvinceCollection.cs b/ImperatorToCK3/Imperator/Provinces/ProvinceCollection.cs index fa60bf781..51c1c65f9 100644 --- a/ImperatorToCK3/Imperator/Provinces/ProvinceCollection.cs +++ b/ImperatorToCK3/Imperator/Provinces/ProvinceCollection.cs @@ -63,7 +63,7 @@ private void DetermineImpassableOwnership(MapData irMapData) { // Group the neighboring provinces by their owner. The one with most owned neighbors may be the owner of the impassable. var ownerCandidate = neighborProvIds - .Select(provId => this[provId].OwnerCountry) + .Select(provId => TryGetValue(provId, out var prov) ? prov.OwnerCountry : null) .Where(country => country is not null) .GroupBy(country => country) .OrderByDescending(group => group.Count())