Skip to content

Commit

Permalink
Don't load cultures without a valid language (#1824) #patch
Browse files Browse the repository at this point in the history
Sentry event ID: 6a18841dcfef4bedb55ac534d6c96b65
  • Loading branch information
IhateTrains authored Mar 10, 2024
1 parent a5619d2 commit dacf5c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public class CultureCollectionTests {
private static readonly List<string> ck3ModFlags = [];

static CultureCollectionTests() {
pillars = new PillarCollection(colorFactory, []) { new("test_heritage", new PillarData { Type = "heritage" }) };
pillars = new PillarCollection(colorFactory, []) {
new("test_heritage", new PillarData { Type = "heritage" }),
new("test_language", new PillarData { Type = "language" })
};
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ culture_with_color = {
color = rgb { 10 20 30 }

heritage = test_heritage
language = test_language
name_list = test_name_list
}

culture_without_color = {
heritage = test_heritage
language = test_language
name_list = test_name_list
}
4 changes: 4 additions & 0 deletions ImperatorToCK3/CK3/Cultures/CultureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ private void LoadCulture(string cultureId, BufferedReader cultureReader) {
Logger.Warn($"Culture {cultureId} has no heritage defined! Skipping.");
return;
}
if (cultureData.Language is null) {
Logger.Warn($"Culture {cultureId} has no language defined! Skipping.");
return;
}
if (cultureData.NameLists.Count == 0) {
Logger.Warn($"Culture {cultureId} has no name list defined! Skipping.");
return;
Expand Down

0 comments on commit dacf5c3

Please sign in to comment.