From 725e26b11a5e45946ae13ea854d045a345c77904 Mon Sep 17 00:00:00 2001 From: dystopm Date: Mon, 12 Feb 2024 22:31:14 -0300 Subject: [PATCH] Fix ApplyMultiDamage duplicated call on MultiDamage routine --- regamedll/dlls/weapons.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 2c035c746..bb65c40f8 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -107,8 +107,14 @@ void EXT_FUNC __API_HOOK(AddMultiDamage)(entvars_t *pevInflictor, CBaseEntity *p if (pEntity != gMultiDamage.pEntity) { - // UNDONE: wrong attacker! - ApplyMultiDamage(pevInflictor, pevInflictor); +#ifdef REGAMEDLL_FIXES + if (gMultiDamage.pEntity) // avoid api calls with null default pEntity +#endif + { + // UNDONE: wrong attacker! + ApplyMultiDamage(pevInflictor, pevInflictor); + } + gMultiDamage.pEntity = pEntity; gMultiDamage.amount = 0; }