fixed potential nil pointer

This commit is contained in:
2021-11-17 22:05:05 +01:00
parent 85b38b07c1
commit 3e727d3a7c

View File

@@ -166,6 +166,10 @@ func (p *DemoParser) getMatchPlayerBySteamID(stats []*ent.MatchPlayer, steamId u
} }
func setMatchPlayerColor(matchPlayer *ent.MatchPlayer, demoPlayer *common.Player) { func setMatchPlayerColor(matchPlayer *ent.MatchPlayer, demoPlayer *common.Player) {
if matchPlayer == nil || demoPlayer == nil {
return
}
matchPlayer.Crosshair = demoPlayer.CrosshairCode() matchPlayer.Crosshair = demoPlayer.CrosshairCode()
switch demoPlayer.Color() { switch demoPlayer.Color() {
case common.Yellow: case common.Yellow: