From 001e7c17504899058082398a794bd2122b5ef7ae Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Fri, 1 Jul 2022 12:04:38 +0700 Subject: [PATCH] Fix `othersConsole` missing during Executed() call --- sources/Commands/Command.uc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sources/Commands/Command.uc b/sources/Commands/Command.uc index 9a52729..03835f2 100644 --- a/sources/Commands/Command.uc +++ b/sources/Commands/Command.uc @@ -368,6 +368,7 @@ public final function bool Execute(CallData callData, EPlayer callerPlayer) { local int i; local array targetPlayers; + if (callerPlayer == none) return false; if (!callerPlayer.IsExistent()) return false; @@ -380,10 +381,14 @@ public final function bool Execute(CallData callData, EPlayer callerPlayer) targetPlayers = callData.targetPlayers; publicConsole = _.console.ForAll(); callerConsole = _.console.For(callerPlayer); - callerConsole.Write(P("Executing command `")) + callerConsole + .Write(P("Executing command `")) .Write(commandData.name) .Say(P("`")); + // `othersConsole` should also exist in time for `Executed()` call + othersConsole = _.console.ForAll().ButPlayer(callerPlayer); Executed(callData, callerPlayer); + _.memory.Free(othersConsole); if (commandData.requiresTarget) { for (i = 0; i < targetPlayers.length; i += 1)