From 2cb28b8f01a1ce16e10489f82880d73356f6c3b0 Mon Sep 17 00:00:00 2001 From: Marcus Sundberg Date: Sat, 5 Feb 2000 16:03:37 +0000 Subject: [PATCH] Prevent division by zero in CalcFov(). --- qw_client/screen.c | 2 +- uquake/screen.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qw_client/screen.c b/qw_client/screen.c index 20a0fdc..260fee0 100644 --- a/qw_client/screen.c +++ b/qw_client/screen.c @@ -268,7 +268,7 @@ float CalcFov (float fov_x, float width, float height) x = width/tan(fov_x/360*M_PI); - a = atan (height/x); + a = (x == 0) ? 90 : atan(height/x); a = a*360/M_PI; diff --git a/uquake/screen.c b/uquake/screen.c index 408e608..4bd9792 100644 --- a/uquake/screen.c +++ b/uquake/screen.c @@ -273,7 +273,7 @@ float CalcFov (float fov_x, float width, float height) x = width/tan(fov_x/360*M_PI); - a = atan (height/x); + a = (x == 0) ? 90 : atan(height/x); a = a*360/M_PI;