From: terencehill Date: Sat, 21 Dec 2019 23:39:52 +0000 (+0100) Subject: Fix #2365 "Div by zero at hydroxon startup" X-Git-Tag: xonotic-v0.8.5~1202 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=917131b11f0f3a725c80ee1c3dc357fa9e6f8795;p=xonotic%2Fxonotic-data.pk3dir.git Fix #2365 "Div by zero at hydroxon startup" --- diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index 03b2ec9d1..8ce4d6f31 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -1387,7 +1387,7 @@ void havocbot_ctf_calculate_middlepoint() // for symmetrical editing of waypoints entity f1 = ctf_worldflaglist; entity f2 = f1.ctf_worldflagnext; - float m = -(f1.origin.y - f2.origin.y) / (f1.origin.x - f2.origin.x); + float m = -(f1.origin.y - f2.origin.y) / (max(f1.origin.x - f2.origin.x, FLOAT_EPSILON)); float q = havocbot_middlepoint.y - m * havocbot_middlepoint.x; havocbot_symmetry_axis_m = m; havocbot_symmetry_axis_q = q;