From 6942d4f8ce4a81660089c1da81d47494ecede851 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Mon, 15 Aug 2016 23:22:43 +0200 Subject: [PATCH] Fix crash on "status" when host_client lookup fails Block execution of the "status" command on the sourcetv bot, if the address of the host_client pointer failed to be found. This at least prevents the known crash in Host_Client_Printf if we can't work around it. --- hltvserverwrapper.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hltvserverwrapper.cpp b/hltvserverwrapper.cpp index 4447707..781d86b 100644 --- a/hltvserverwrapper.cpp +++ b/hltvserverwrapper.cpp @@ -194,7 +194,13 @@ void HLTVServerWrapper::OnHLTVServerShutdown() bool HLTVServerWrapper::OnHLTVBotExecuteStringCommand(const char *s) { if (!host_client) - RETURN_META_VALUE(MRES_IGNORED, 0); + { + // Block crash in status command. + if (!Q_stricmp(s, "status")) + RETURN_META_VALUE(MRES_SUPERCEDE, 0); + else + RETURN_META_VALUE(MRES_IGNORED, 0); + } IClient *pClient = META_IFACEPTR(IClient); if (!pClient)