Skip to content

Commit

Permalink
Merge pull request #248 from ScriptedSnark/master
Browse files Browse the repository at this point in the history
Client: fix GetThisPlayerInfo crash
  • Loading branch information
tmp64 authored Sep 29, 2024
2 parents 66d5785 + 7d41851 commit 98d50f3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/game/client/hud/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ void CHudChat::ChatPrintf(int iPlayerIndex, const char *fmt, ...)
}

// If a player is muted for voice, also mute them for text because jerks gonna jerk.
if (cl_mute_all_comms.GetBool() && iPlayerIndex != 0 && iPlayerIndex != GetThisPlayerInfo()->GetIndex())
if (GetThisPlayerInfo() && cl_mute_all_comms.GetBool() && iPlayerIndex != 0 && iPlayerIndex != GetThisPlayerInfo()->GetIndex())
{
if (GetClientVoiceMgr() && GetClientVoiceMgr()->IsPlayerBlocked(iPlayerIndex))
return;
Expand Down
6 changes: 6 additions & 0 deletions src/game/client/hud/death_notice_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ void CHudDeathNoticePanel::Think()

void CHudDeathNoticePanel::AddItem(int killerId, int victimId, const char *killedwith)
{
if (!GetThisPlayerInfo())
{
// Not yet connected
return;
}

Entry e;
CPlayerInfo *killer = GetPlayerInfoSafe(killerId);
CPlayerInfo *victim = GetPlayerInfoSafe(victimId);
Expand Down
6 changes: 6 additions & 0 deletions src/game/client/vgui/score_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ void CScorePanel::UpdateOnPlayerInfo(int client)

void CScorePanel::DeathMsg(int killer, int victim)
{
if (!GetThisPlayerInfo())
{
// Not yet connected
return;
}

if (victim == GetThisPlayerInfo()->GetIndex())
{
// if we were the one killed, set the scoreboard to indicate killer
Expand Down

0 comments on commit 98d50f3

Please sign in to comment.