From a192ff1beae1148808fa7ffae5cd5eac734cbf52 Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Wed, 23 Jun 2021 19:40:04 +0200 Subject: [PATCH] Fix a sightlines crash --- src/hacks/ESP.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index c02ee46d..48b59cd6 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -480,7 +480,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) if (sightlines && type == ENTITY_PLAYER) { // Logic for using the enum to sort out snipers - if ((int) sightlines == 2 || ((int) sightlines == 1 && CE_INT(ent, netvar.iClass) == tf_sniper)) + if (((int) sightlines == 2 || ((int) sightlines == 1 && CE_INT(ent, netvar.iClass) == tf_sniper)) && CE_GOOD(ent) && ent->hitboxes.GetHitbox(0)) { PROF_SECTION(PT_esp_sightlines); @@ -1849,12 +1849,14 @@ void SetEntityColor(CachedEntity *entity, const rgba_t &color) data[entity->m_IDX].color = color; } -static InitRoutine init([]() { - EC::Register(EC::CreateMove, cm, "cm_esp", EC::average); +static InitRoutine init( + []() + { + EC::Register(EC::CreateMove, cm, "cm_esp", EC::average); #if ENABLE_VISUALS - EC::Register(EC::Draw, Draw, "draw_esp", EC::average); - Init(); + EC::Register(EC::Draw, Draw, "draw_esp", EC::average); + Init(); #endif -}); + }); } // namespace hacks::shared::esp