diff --git a/CHANGELOG.md b/CHANGELOG.md index 1086c96b..8fa46ea0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * Fixed torch and medic grunts, male assassins and shock troopers continuing to fire for a few seconds after killing the last enemy in an area [#100](https://github.com/SamVanheer/halflife-op4-updated/issues/100) (Thanks Ronin4862 and malortie) * Fixed Gonome crashing the game if the player dies while being damaged by Gonome's chest mouth (Thanks malortie) * Save and restore allied grunt repel entities to ensure spawned NPCs have correct properties (Thanks malortie) +* Fixed crash when +USEing NPCs that have just exited a scripted sequence (Thanks malortie) ## Changes in V1.0.0 Release Candidate 001 diff --git a/dlls/COFAllyMonster.cpp b/dlls/COFAllyMonster.cpp index 1bed0f5f..dfd0c10f 100644 --- a/dlls/COFAllyMonster.cpp +++ b/dlls/COFAllyMonster.cpp @@ -1363,7 +1363,10 @@ bool COFAllyMonster::CanFollow() { if (m_MonsterState == MONSTERSTATE_SCRIPT) { - if (!m_pCine->CanInterrupt()) + // It's possible for m_MonsterState to still be MONSTERSTATE_SCRIPT when the script has already ended. + // We'll treat a null pointer as an uninterruptable script and wait for the NPC to change states + // before allowing players to make them follow them again. + if (!m_pCine || !m_pCine->CanInterrupt()) return false; }