Skip to content

Commit

Permalink
Add conditional access to ResolveVariable usages after commonItems AP…
Browse files Browse the repository at this point in the history
…I change (#1645) #patch
  • Loading branch information
IhateTrains authored Dec 16, 2023
1 parent 8d8e396 commit 1b81c32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ImperatorToCK3/Mappers/Culture/CultureMappingRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static CultureMappingRule() {
parser.RegisterKeyword("ck3Province", reader => mappingToReturn.ck3Provinces.Add(reader.GetULong()));
parser.RegisterKeyword("irProvince", reader => mappingToReturn.irProvinces.Add(reader.GetULong()));
parser.RegisterRegex(CommonRegexes.Variable, (reader, variableName) => {
var variableValue = reader.ResolveVariable(variableName).ToString() ?? string.Empty;
var variableValue = reader.ResolveVariable(variableName)?.ToString() ?? string.Empty;
var variableReader = new BufferedReader(variableValue);
variableReader.CopyVariables(reader);
parser.ParseStream(variableReader);
Expand Down
2 changes: 1 addition & 1 deletion ImperatorToCK3/Mappers/Religion/ReligionMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static ReligionMapping() {
parser.RegisterKeyword("historicalTag", reader => mappingToReturn.irHistoricalTags.Add(reader.GetString()));
parser.RegisterKeyword("heresiesInHistoricalAreas", reader => mappingToReturn.heresiesInHistoricalAreas = reader.GetBool());
parser.RegisterRegex(CommonRegexes.Variable, (reader, variableName) => {
var variableValue = reader.ResolveVariable(variableName).ToString() ?? string.Empty;
var variableValue = reader.ResolveVariable(variableName)?.ToString() ?? string.Empty;
var variableReader = new BufferedReader(variableValue);
variableReader.CopyVariables(reader);
parser.ParseStream(variableReader);
Expand Down

0 comments on commit 1b81c32

Please sign in to comment.