From: Samual Lenks Date: Mon, 31 Dec 2012 18:50:06 +0000 (-0500) Subject: Avoid division by zero on latency calculation (real clients only) X-Git-Tag: xonotic-v0.7.0~146 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=343ad98e82555ee872e19d5ceca9591a62f4852d;p=xonotic%2Fxonotic-data.pk3dir.git Avoid division by zero on latency calculation (real clients only) --- diff --git a/qcsrc/server/playerstats.qc b/qcsrc/server/playerstats.qc index a95eed67a..41af30157 100644 --- a/qcsrc/server/playerstats.qc +++ b/qcsrc/server/playerstats.qc @@ -377,8 +377,14 @@ void PlayerStats_EndMatch(float finished) if((g_arena || g_lms || g_ca) && (p.alivetime <= 0)) { continue; } else if(p.classname != "player") { continue; } - float latency = (p.latency_sum / p.latency_cnt); - if(latency) { PlayerStats_Event(p, PLAYERSTATS_AVGLATENCY, latency); } + if(clienttype(p) == CLIENTTYPE_REAL) + { + if(p.latency_cnt) + { + float latency = (p.latency_sum / p.latency_cnt); + if(latency) { PlayerStats_Event(p, PLAYERSTATS_AVGLATENCY, latency); } + } + } PlayerScore_PlayerStats(p); PlayerStats_Event(p, PLAYERSTATS_SCOREBOARD_VALID, 1);