Skip to content

Commit

Permalink
fix: possible invalid pawn entity
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver committed Dec 29, 2023
1 parent b8323a8 commit 9235227
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/demoinfocs/common/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ type Player struct {
}

func (p *Player) PlayerPawnEntity() st.Entity {
playerPawn, exists := p.Entity.PropertyValue("m_hPlayerPawn")
playerPawn, exists := p.Entity.PropertyValue("m_hPawn")
if !exists {
return nil
}

return p.demoInfoProvider.FindEntityByHandle(playerPawn.Handle())
handle := playerPawn.Handle()
if handle == constants.InvalidEntityHandleSource2 {
return nil
}

return p.demoInfoProvider.FindEntityByHandle(handle)
}

func (p *Player) GetTeam() Team {
Expand Down

0 comments on commit 9235227

Please sign in to comment.