Skip to content

Commit dacf5c3

Browse files
authored
Don't load cultures without a valid language (#1824) #patch
Sentry event ID: 6a18841dcfef4bedb55ac534d6c96b65
1 parent a5619d2 commit dacf5c3

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

ImperatorToCK3.UnitTests/CK3/Cultures/CultureCollectionTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ public class CultureCollectionTests {
1717
private static readonly List<string> ck3ModFlags = [];
1818

1919
static CultureCollectionTests() {
20-
pillars = new PillarCollection(colorFactory, []) { new("test_heritage", new PillarData { Type = "heritage" }) };
20+
pillars = new PillarCollection(colorFactory, []) {
21+
new("test_heritage", new PillarData { Type = "heritage" }),
22+
new("test_language", new PillarData { Type = "language" })
23+
};
2124
}
2225

2326
[Fact]

ImperatorToCK3.UnitTests/TestFiles/CK3/game/common/culture/cultures/test_cultures.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ culture_with_color = {
22
color = rgb { 10 20 30 }
33

44
heritage = test_heritage
5+
language = test_language
56
name_list = test_name_list
67
}
78

89
culture_without_color = {
910
heritage = test_heritage
11+
language = test_language
1012
name_list = test_name_list
1113
}

ImperatorToCK3/CK3/Cultures/CultureCollection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ private void LoadCulture(string cultureId, BufferedReader cultureReader) {
117117
Logger.Warn($"Culture {cultureId} has no heritage defined! Skipping.");
118118
return;
119119
}
120+
if (cultureData.Language is null) {
121+
Logger.Warn($"Culture {cultureId} has no language defined! Skipping.");
122+
return;
123+
}
120124
if (cultureData.NameLists.Count == 0) {
121125
Logger.Warn($"Culture {cultureId} has no name list defined! Skipping.");
122126
return;

0 commit comments

Comments
 (0)