From 076d40510ceb415739104417ed2c2e9c555237fb Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Fri, 5 Oct 2018 14:23:38 +0200 Subject: [PATCH] Fix crash when trying to decode NULL this pointer When the this pointer is set to ThisPointer_CBaseEntity and the address is null, just return INVALID_ENT_REFERENCE instead of trying to access the pointer. --- vhook.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vhook.cpp b/vhook.cpp index 97bf5c1..4c47220 100644 --- a/vhook.cpp +++ b/vhook.cpp @@ -381,6 +381,8 @@ cell_t GetThisPtr(void *iface, ThisPointerType type) { if(type == ThisPointer_CBaseEntity) { + if (!iface) + return -1; return gamehelpers->EntityToBCompatRef((CBaseEntity *)iface); }