Skip to content

Commit

Permalink
fix another POV crash
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-wa committed Apr 4, 2024
1 parent 95a66fd commit 054bd08
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/demoinfocs/datatables.go
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,10 @@ func (p *parser) bindWeaponS2(entity st.Entity) {
)

entity.Property("m_hOwnerEntity").OnUpdate(func(val st.PropertyValue) {
if val.Any == nil {
return
}

owner := p.GameState().Participants().FindByPawnHandle(val.Handle())
if owner == nil {
equipment.Owner = nil
Expand Down Expand Up @@ -1142,7 +1146,14 @@ func (p *parser) bindWeaponS2(entity st.Entity) {
return
}

shooter := p.GameState().Participants().FindByPawnHandle(entity.PropertyValueMust("m_hOwnerEntity").Handle())
ownerHandleVal := entity.PropertyValueMust("m_hOwnerEntity")

var shooter *common.Player

if ownerHandleVal.Any != nil {
shooter = p.GameState().Participants().FindByPawnHandle(ownerHandleVal.Handle())
}

if shooter == nil {
shooter = equipment.Owner
}
Expand Down

0 comments on commit 054bd08

Please sign in to comment.