From 00dc161628730e2995065637fdc859b69c0efb78 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Fri, 5 Oct 2018 00:33:07 +0200 Subject: [PATCH] Add a proper exception when creating an actor with an invalid owner in Lua --- OpenRA.Mods.Common/Scripting/Global/ActorGlobal.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenRA.Mods.Common/Scripting/Global/ActorGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/ActorGlobal.cs index 327b442a85..e72c7c408a 100644 --- a/OpenRA.Mods.Common/Scripting/Global/ActorGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/ActorGlobal.cs @@ -56,6 +56,10 @@ namespace OpenRA.Mods.Common.Scripting } } + var owner = initDict.GetOrDefault(); + if (owner == null) + throw new LuaException("Tried to create actor '{0}' with an invalid or no owner init!".F(type)); + // The actor must be added to the world at the end of the tick var a = Context.World.CreateActor(false, type, initDict); if (addToWorld)