From cc9f40c5f734f58c18a9a4ee18e85736d60ffc42 Mon Sep 17 00:00:00 2001 From: iht Date: Thu, 15 May 2025 00:14:07 +0200 Subject: [PATCH] Fix exception when determining the "ownership" of an I:R impassable Related to failed job: https://github.com/ParadoxGameConverters/ImperatorToCK3/actions/runs/15014403802/job/42188997075 --- ImperatorToCK3/Imperator/Provinces/ProvinceCollection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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())