Skip to content

Commit

Permalink
Fix KeyNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains committed Jan 21, 2025
1 parent 5069639 commit 8ee5388
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ImperatorToCK3/CK3/Religions/Faith.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ public string Serialize(string indent, bool withBraces) {
}

public OrderedSet<string> GetDoctrineIdsForDoctrineCategoryId(string doctrineCategoryId) {
var category = Religion.ReligionCollection.DoctrineCategories[doctrineCategoryId];
if (!Religion.ReligionCollection.DoctrineCategories.TryGetValue(doctrineCategoryId, out var category)) {
Logger.Warn($"Doctrine category {doctrineCategoryId} not found.");
return [];
}

return GetDoctrineIdsForDoctrineCategory(category);
}

Expand Down

0 comments on commit 8ee5388

Please sign in to comment.