From aa47f1e769432c5af8566c52a6de0f4ce4abf4cd Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 8 Feb 2015 18:01:22 +1100 Subject: [PATCH] Add some extra checks to event_damage, to prevent possible crashes --- qcsrc/common/monsters/sv_monsters.qc | 3 ++- qcsrc/server/cl_client.qc | 3 ++- qcsrc/server/mutators/mutator_bloodloss.qc | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index a0089eead..923a6ad5e 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -721,7 +721,8 @@ void Monster_Move(float runspeed, float walkspeed, float stpspeed, float manim_r { Unfreeze(self); self.health = 0; - self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE, self.origin, '0 0 0'); + if(self.event_damage) + self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE, self.origin, '0 0 0'); } else if ( self.revive_progress <= 0 ) diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 072aca612..24df73bd4 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -2530,7 +2530,8 @@ void PlayerPreThink (void) { if(self.vehicle) vehicles_exit(VHEF_RELEASE); - self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE, self.origin, '0 0 0'); + if(self.event_damage) + self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE, self.origin, '0 0 0'); } else if ( self.revive_progress <= 0 ) Unfreeze(self); diff --git a/qcsrc/server/mutators/mutator_bloodloss.qc b/qcsrc/server/mutators/mutator_bloodloss.qc index c4cd8cf0a..9b2750049 100644 --- a/qcsrc/server/mutators/mutator_bloodloss.qc +++ b/qcsrc/server/mutators/mutator_bloodloss.qc @@ -13,7 +13,8 @@ MUTATOR_HOOKFUNCTION(bloodloss_PlayerThink) { if(self.vehicle) vehicles_exit(VHEF_RELEASE); - self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0'); + if(self.event_damage) + self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0'); self.bloodloss_timer = time + 0.5 + random() * 0.5; } } -- 2.39.2