Skip to content

Commit 8f81eee

Browse files
committed
Fix a crash occuring with the DecloakToFire fix
1 parent bafc20b commit 8f81eee

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Ext/Techno/Hooks.Cloak.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,18 @@ DEFINE_HOOK(0x6F7792, TechnoClass_InWeaponRange_DecloakToFire, 0xA)
8484
GET(AbstractClass*, pTarget, EBX);
8585
GET(int, weaponIndex, EAX);
8686

87-
if (CloakTemp::IsInReadyToCloak && !pThis->GetWeapon(weaponIndex)->WeaponType->DecloakToFire)
88-
R->EAX(0);
89-
else
90-
R->EAX(pThis->IsCloseEnough(pTarget, weaponIndex));
87+
if (CloakTemp::IsInReadyToCloak)
88+
{
89+
auto const pWeapon = pThis->GetWeapon(weaponIndex)->WeaponType;
90+
91+
if (pWeapon && !pWeapon->DecloakToFire)
92+
{
93+
R->EAX(0);
94+
return SkipGameCode;
95+
}
96+
}
9197

98+
R->EAX(pThis->IsCloseEnough(pTarget, weaponIndex));
9299
return SkipGameCode;
93100
}
94101

0 commit comments

Comments
 (0)