Skip to content

Commit

Permalink
Fix InvalidOperationException while converting governorships (#1857) …
Browse files Browse the repository at this point in the history
…#patch

Sentry event ID: 37a9fed8f2c64cf8a66e2e52f380f546
  • Loading branch information
IhateTrains authored Mar 28, 2024
1 parent f854566 commit c53356b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ImperatorToCK3/Mappers/TagTitle/TagTitleMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ public void RegisterGovernorship(string imperatorRegion, string imperatorCountry
var countryCapitalDuchy = ck3CapitalCounty.DeJureLiege;

foreach (var county in titles.Where(t => t.Rank == TitleRank.county)) {
ulong capitalBaronyProvinceId = (ulong)county.CapitalBaronyProvinceId!;
if (!county.CapitalBaronyProvinceId.HasValue) {
// Title has no capital barony province.
continue;
}
ulong capitalBaronyProvinceId = county.CapitalBaronyProvinceId.Value;
if (capitalBaronyProvinceId == 0) {
// title's capital province has an invalid ID (0 is not a valid province in CK3)
// Title's capital province has an invalid ID (0 is not a valid province in CK3)
continue;
}

Expand Down

0 comments on commit c53356b

Please sign in to comment.