Skip to content

Commit e09b85f

Browse files
committed
Fix crash from CFire::Extinguish hook
1 parent 7daf0cc commit e09b85f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Client/game_sa/CFireSA.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,12 @@ void CFireSA::SetNumGenerationsAllowed(char generations)
217217
//
218218
// Fix GH #3249 (PLAYER_ON_FIRE task is not aborted after the fire is extinguished)
219219
////////////////////////////////////////////////////////////////////////
220-
static void AbortFireTask(CEntitySAInterface* entityOnFire)
220+
static void AbortFireTask(CEntitySAInterface* entityOnFire, DWORD returnAddress)
221221
{
222+
// We can't and shouldn't remove the task if we're in CTaskSimplePlayerOnFire::ProcessPed. Otherwise we will crash.
223+
if (returnAddress == 0x633783)
224+
return;
225+
222226
auto ped = pGame->GetPools()->GetPed(reinterpret_cast<DWORD*>(entityOnFire));
223227
if (!ped || !ped->pEntity)
224228
return;
@@ -238,10 +242,12 @@ static void _declspec(naked) HOOK_CFire_Extinguish()
238242
_asm
239243
{
240244
mov [eax+730h], edi
245+
mov ebx, [esp+8]
241246

247+
push ebx
242248
push eax
243249
call AbortFireTask
244-
add esp, 4
250+
add esp, 8
245251

246252
jmp CONTINUE_CFire_Extinguish
247253
}

0 commit comments

Comments
 (0)