From 491e7c6feaa0ab12945c52b0f1818f4e26db9247 Mon Sep 17 00:00:00 2001 From: ehofman Date: Thu, 15 Jan 2004 18:10:00 +0000 Subject: [PATCH] Fix a posible devide by zero situation --- src/Time/light.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Time/light.cxx b/src/Time/light.cxx index e4f67467c..72cc06fdd 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -297,6 +297,9 @@ void FGLight::update_adj_fog_color () { float avf = 0.87 - (45000 - av) / 83333.33; float sif = 0.5 - cos(_sun_angle*2)/2; + if (sif < 1e-4) + sif = 1e-4; + float rf1 = fabs((rotation - SGD_PI) / SGD_PI); // 0.0 .. 1.0 float rf2 = avf * pow(rf1 * rf1, 1/sif); float rf3 = 0.94 - rf2;