From 6cac489fce5ef2b3400fd92d3781aac21331d4e7 Mon Sep 17 00:00:00 2001 From: ojlanders <143576142+ojlanders@users.noreply.github.com> Date: Thu, 18 Apr 2024 07:42:37 -0400 Subject: [PATCH] Prevent recursion in sm_ServerCommandEx (fixes #967) (#2133) * Prevent recursion in sm_ServerCommandEx (fixes #967) * Update core/smn_console.cpp to fix style Co-authored-by: Erin --------- Co-authored-by: Odin Landers Co-authored-by: Erin --- core/smn_console.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/smn_console.cpp b/core/smn_console.cpp index dc036684..29b830a8 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -979,11 +979,14 @@ static cell_t sm_ServerCommandEx(IPluginContext *pContext, const cell_t *params) } engine->ServerExecute(); - - g_ShouldCatchSpew = true; - engine->ServerCommand("sm_conhook_start\n"); - engine->ServerCommand(buffer); - engine->ServerCommand("sm_conhook_stop\n"); + if (!g_ShouldCatchSpew) { + g_ShouldCatchSpew = true; + engine->ServerCommand("sm_conhook_start\n"); + engine->ServerCommand(buffer); + engine->ServerCommand("sm_conhook_stop\n"); + } else { + engine->ServerCommand(buffer); + } engine->ServerExecute();