From fdd3bffa1d065b1313a755c15c2ee5fef896ed11 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 30 Sep 2019 20:59:00 +0200 Subject: [PATCH] Throw a lua exception when setting an owner to null/nil --- OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs index 411dc92e87..41fb991f9c 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs @@ -60,6 +60,9 @@ namespace OpenRA.Mods.Common.Scripting set { + if (value == null) + throw new LuaException("Attempted to change the owner of actor '{0}' to nil value.".F(Self)); + if (Self.Owner != value) Self.ChangeOwner(value); }