From 4ecf42799dba741a8cf0af57ee134522aa640753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mu=C3=B1oz?= Date: Wed, 8 May 2024 11:18:36 -0400 Subject: [PATCH] Fix ApplyMultiDamage duplicated call on MultiDamage routine (#946) --- 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 b44b288dd..4ea949128 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; }