From eb76f695c59c33e1117454a242fe5189e7a24579 Mon Sep 17 00:00:00 2001 From: zaCade Date: Tue, 31 Oct 2017 18:59:55 +0100 Subject: [PATCH] FixPointTeleport: potentially fix crash issue. --- FixPointTeleport/scripting/FixPointTeleport.sp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/FixPointTeleport/scripting/FixPointTeleport.sp b/FixPointTeleport/scripting/FixPointTeleport.sp index a96126d3..81d2b6ad 100644 --- a/FixPointTeleport/scripting/FixPointTeleport.sp +++ b/FixPointTeleport/scripting/FixPointTeleport.sp @@ -4,8 +4,8 @@ #include #include -Handle hTeleport; Handle hFallInit; +Handle hTeleport; //---------------------------------------------------------------------------------------------------- // Purpose: @@ -64,7 +64,7 @@ public void OnPluginStart() // Late load. int entity = INVALID_ENT_REFERENCE; - while((entity = FindEntityByClassname(entity, "weapon_*")) != INVALID_ENT_REFERENCE) + while ((entity = FindEntityByClassname(entity, "weapon_*")) != INVALID_ENT_REFERENCE) { OnEntityCreated(entity, "weapon_*"); } @@ -88,5 +88,8 @@ public void OnEntityCreated(int entity, const char[] classname) //---------------------------------------------------------------------------------------------------- public MRESReturn OnEntityTeleport(int entity, Handle hParams) { - SDKCall(hFallInit, entity); + if (IsValidEntity(entity)) + { + SDKCall(hFallInit, entity); + } } \ No newline at end of file