diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index d73850cb4944205196471d64d93a88fec5f4ad25..bb80988854e4c6b948ff3ffa2d78f23c86298929 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -975,7 +975,10 @@ void LLVOSky::calcAtmospherics(void)
 		}
 
 		temp2.mV[1] = llmax(0.f, lighty);
-		temp2.mV[1] = 1.f / temp2.mV[1];
+		if(temp2.mV[1] > 0.f)
+		{
+			temp2.mV[1] = 1.f / temp2.mV[1];
+		}
 		componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1]));
 
 		// Distance