Skip to content

Commit

Permalink
Fix NREs in CheckUnknownWeaponFields
Browse files Browse the repository at this point in the history
  • Loading branch information
abcdefg30 authored and pchote committed Jun 26, 2022
1 parent 82692b9 commit c1822d1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions OpenRA.Mods.Common/Lint/CheckUnknownWeaponFields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ void CheckWeapons(IEnumerable<MiniYamlNode> weapons, Action<string> emitError, A
{
var projectileName = NormalizeName(field.Value.Value);
var projectileInfo = modData.ObjectCreator.FindType(projectileName + "Info");
if (projectileInfo == null)
{
emitError($"{field.Location} defines unknown projectile `{projectileName}`.");
continue;
}

foreach (var projectileField in field.Value.Nodes)
{
var projectileFieldName = NormalizeName(projectileField.Key);
Expand All @@ -85,6 +91,12 @@ void CheckWeapons(IEnumerable<MiniYamlNode> weapons, Action<string> emitError, A

var warheadName = NormalizeName(field.Value.Value);
var warheadInfo = modData.ObjectCreator.FindType(warheadName + "Warhead");
if (warheadInfo == null)
{
emitError($"{field.Location} defines unknown warhead `{warheadName}`.");
continue;
}

foreach (var warheadField in field.Value.Nodes)
{
var warheadFieldName = NormalizeName(warheadField.Key);
Expand Down

0 comments on commit c1822d1

Please sign in to comment.