From f05e3e871f5755e6d015aa502042ae10a4ad1111 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 31 Oct 2018 17:32:23 +0000 Subject: [PATCH] Fix crash when Inherits has child nodes. --- OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs b/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs index d708bab86a..5dba154a14 100644 --- a/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs +++ b/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs @@ -41,6 +41,13 @@ namespace OpenRA.Mods.Common.Lint continue; } + // Inherits can never define children + if (NormalizeName(t.Key) == "Inherits" && t.Value.Nodes.Any()) + { + emitError("{0} defines child nodes, which are not valid for Inherits.".F(t.Location)); + continue; + } + var traitName = NormalizeName(t.Key); var traitInfo = modData.ObjectCreator.FindType(traitName + "Info"); foreach (var field in t.Value.Nodes)