Skip to content

Commit

Permalink
fix: prevent null exception when access label fields in the rule (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
laicasaane authored Jan 6, 2022
1 parent f83865a commit cebf133
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Editor/AddressableImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,24 @@ static AddressableAssetEntry CreateOrUpdateAddressableAssetEntry(
// Add labels
if (rule.LabelMode == LabelWriteMode.Replace)
entry.labels.Clear();
foreach (var label in rule.labelsRefsEnum)

if (rule.labelsRefsEnum != null)
{
entry.labels.Add(label);
foreach (var label in rule.labelsRefsEnum)
{
entry.labels.Add(label);
}
}

foreach (var dynamicLabel in rule.dynamicLabels)
if (rule.dynamicLabels != null)
{
var label = rule.ParseReplacement(assetPath, dynamicLabel);
settings.AddLabel(label);
entry.labels.Add(label);
foreach (var dynamicLabel in rule.dynamicLabels)
{
var label = rule.ParseReplacement(assetPath, dynamicLabel);
settings.AddLabel(label);
entry.labels.Add(label);
}
}

}
return entry;
}
Expand Down

0 comments on commit cebf133

Please sign in to comment.