From: terencehill Date: Wed, 30 May 2018 12:28:52 +0000 (+0200) Subject: Prevent a division by 0 X-Git-Tag: xonotic-v0.8.5~2121 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=e95e817d04d9233dd9d3ce3f70f09de8379ed443 Prevent a division by 0 --- diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 0faf7068cf..326a26219b 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -583,15 +583,16 @@ void Draw_WaypointSprite(entity this) { // scale it to be just in view vector d; - float f1, f2; d = o - '0.5 0 0' * vid_conwidth - '0 0.5 0' * vid_conheight; ang = atan2(-d.x, -d.y); if (o.z < 0) ang += M_PI; - f1 = d.x / vid_conwidth; - f2 = d.y / vid_conheight; + float f1 = d.x / vid_conwidth; + float f2 = d.y / vid_conheight; + if (f1 == 0) { f1 = 0.000001; } + if (f2 == 0) { f2 = 0.000001; } if (max(f1, -f1) > max(f2, -f2)) { if (d.z * f1 > 0) {