From 5d234bb9d68ae56cf7537d4e2bfdd27fc2b55e94 Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Sat, 23 Sep 2017 23:27:32 -0700 Subject: [PATCH] Fix OnPlayerRunCmd crashing with invalid CUserCmd ptr. (#693) --- extensions/sdktools/hooks.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/extensions/sdktools/hooks.cpp b/extensions/sdktools/hooks.cpp index d4900e70..3ef57985 100644 --- a/extensions/sdktools/hooks.cpp +++ b/extensions/sdktools/hooks.cpp @@ -191,6 +191,11 @@ void CHookManager::PlayerRunCmdHook(int client, bool post) void CHookManager::PlayerRunCmd(CUserCmd *ucmd, IMoveHelper *moveHelper) { + if (!ucmd) + { + RETURN_META(MRES_IGNORED); + } + if (m_usercmdsFwd->GetFunctionCount() == 0) { RETURN_META(MRES_IGNORED); @@ -254,6 +259,11 @@ void CHookManager::PlayerRunCmd(CUserCmd *ucmd, IMoveHelper *moveHelper) void CHookManager::PlayerRunCmdPost(CUserCmd *ucmd, IMoveHelper *moveHelper) { + if (!ucmd) + { + RETURN_META(MRES_IGNORED); + } + if (m_usercmdsPostFwd->GetFunctionCount() == 0) { RETURN_META(MRES_IGNORED);