From 5ccc735fd896122b52e7a62128261550c60fcb3f Mon Sep 17 00:00:00 2001 From: Richard Helgeby Date: Mon, 20 Aug 2012 22:57:35 +0200 Subject: [PATCH] Fixed invalid client index error when player_death event was sent with bad userid. Should prevent some issues with bugs in other mods. --- src/zr/event.inc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/zr/event.inc b/src/zr/event.inc index 2b14139..4403531 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -271,6 +271,14 @@ public Action:EventPlayerDeath(Handle:event, const String:name[], bool:dontBroad new index = GetClientOfUserId(GetEventInt(event, "userid")); new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); + // Validate client. + if (!ZRIsClientValid(index)) + { + // If the client isn't a player, a player really didn't die now. Some + // other mods might sent this event with bad data. + return; + } + // Forward event to modules. ClassOnClientDeath(index); InfectOnClientDeath(index, attacker);