Skip to content

Commit 7be9c51

Browse files
committed
fix crash if other_death entity doesn't exist
1 parent 665d2c6 commit 7be9c51

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/demoinfocs/game_events.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,14 @@ func (geh gameEventHandler) otherDeath(data map[string]*msg.CSVCMsg_GameEventKey
843843
killer := geh.playerByUserID32(data["attacker"].GetValShort())
844844
otherType := data["othertype"].GetValString()
845845
otherID := data["otherid"].GetValShort()
846-
otherPosition := geh.gameState().entities[int(otherID)].Position()
846+
other := geh.gameState().entities[int(otherID)]
847+
848+
var otherPosition r3.Vector
849+
850+
if other != nil {
851+
otherPosition = other.Position()
852+
}
853+
847854
wepType := common.MapEquipment(data["weapon"].GetValString())
848855
weapon := getPlayerWeapon(killer, wepType)
849856

0 commit comments

Comments
 (0)