crash fix

This commit is contained in:
rei-2 committed 2024-12-16 12:00:51 -05:00
1 parent 7789a92b24
commit 8d63744429
3 files changed
+13 -4

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ void CSpectate::NetUpdateEnd(CTFPlayer* pLocal)
}
else if (pEntity == pLocal)
m_iTarget = -1;
else if (m_iTarget == -1)
if (m_iTarget == -1)
{
if (pLocal->IsAlive())
pLocal->m_iObserverMode() = OBS_MODE_NONE;
@@ -355,7 +355,17 @@ std::vector<std::wstring> CPlayerConditions::Get(CTFPlayer* pEntity)
void CPlayerConditions::Draw(CTFPlayer* pLocal)
{
if (!(Vars::Menu::Indicators.Value & Vars::Menu::IndicatorsEnum::Conditions) || !pLocal->IsAlive())
if (!(Vars::Menu::Indicators.Value & Vars::Menu::IndicatorsEnum::Conditions))
return;
auto pTarget = pLocal;
switch (pLocal->m_iObserverMode())
{
case OBS_MODE_FIRSTPERSON:
case OBS_MODE_THIRDPERSON:
pTarget = pLocal->m_hObserverTarget().Get()->As<CTFPlayer>();
}
if (!pTarget || !pTarget->IsPlayer() || !pTarget->IsAlive())
return;
int x = Vars::Menu::ConditionsDisplay.Value.x;
@@ -375,7 +385,7 @@ void CPlayerConditions::Draw(CTFPlayer* pLocal)
align = ALIGN_TOPRIGHT;
}
std::vector<std::wstring> vConditions = Get(pLocal);
std::vector<std::wstring> vConditions = Get(pTarget);
int iOffset = 0;
for (const std::wstring& sCondition : vConditions)
@@ -62,7 +62,6 @@ void CSpectatorList::Draw(CTFPlayer* pLocal)
return;
}
auto pTarget = pLocal;
switch (pLocal->m_iObserverMode())
{