From 471b0861cd87c61d7557a1c40d1af7fb5b2c762a Mon Sep 17 00:00:00 2001 From: LightCat Date: Mon, 14 Jan 2019 17:11:22 +0100 Subject: [PATCH] Fix crash that apparently exists --- src/helpers.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/helpers.cpp b/src/helpers.cpp index e8aeadcb..898ee62f 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -614,6 +614,8 @@ bool HasWeapon(CachedEntity *ent, int wantedId) int *hWeapons; // Grab the handle and store it into the var hWeapons = (int *) ((unsigned) (RAW_ENT(ent) + netvar.hMyWeapons)); + if (!hWeapons || !RAW_ENT(ent) || ent->m_Type() != ENTITY_PLAYER) + return false; // Go through the handle array and search for the item for (int i = 0; hWeapons[i]; i++) {