From 7e5f3f4a1f71ae012e9aad95de7fbe88a52ad535 Mon Sep 17 00:00:00 2001 From: Sam V Date: Mon, 29 Nov 2021 20:10:50 +0100 Subject: [PATCH] Fix Human Grunt checking enemy incorrectly in CheckMeleeAttack1 Resolves ValveSoftware/halflife#3176 (cherry picked from commit 4dda07c61b770e1f6ee7d8d6656ffe7b1a5f89a6) --- dlls/hgrunt.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 6b5ace63a..6c66b285c 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -413,16 +413,16 @@ bool CHGrunt ::FCanCheckAttacks() //========================================================= bool CHGrunt ::CheckMeleeAttack1(float flDot, float flDist) { - CBaseMonster* pEnemy; + CBaseMonster* pEnemy = nullptr; if (m_hEnemy != NULL) { pEnemy = m_hEnemy->MyMonsterPointer(); + } - if (!pEnemy) - { - return false; - } + if (!pEnemy) + { + return false; } if (flDist <= 64 && flDot >= 0.7 &&