Skip to content

Commit 5ca60c6

Browse files
committed
Possible rare crash fix?
1 parent fc3de6b commit 5ca60c6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/cs2fixes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,15 +784,15 @@ void CS2Fixes::Hook_PostEvent(CSplitScreenSlot nSlot, bool bLocalOnly, int nClie
784784
if (!pSourceEntity)
785785
return;
786786

787-
if (!V_strcasecmp(pSourceEntity->GetClassname(), "player"))
787+
if (pSourceEntity->IsPawn() && ((CCSPlayerPawn*)pSourceEntity)->GetController())
788788
{
789789
playerSlot = ((CCSPlayerPawn*)pSourceEntity)->GetController()->GetPlayerSlot();
790790
}
791791
else if (!V_strncasecmp(pSourceEntity->GetClassname(), "weapon_", 7))
792792
{
793793
CCSPlayerPawn* pPawn = (CCSPlayerPawn*)pSourceEntity->m_hOwnerEntity().Get();
794794

795-
if (pPawn && pPawn->IsPawn())
795+
if (pPawn && pPawn->IsPawn() && pPawn->GetController())
796796
playerSlot = pPawn->GetController()->GetPlayerSlot();
797797
}
798798

0 commit comments

Comments
 (0)