Protect against divide-by-zero error.

Patch from Emilian Huminiuc.
This commit is contained in:
Stuart Buchanan 2015-01-15 21:47:22 +00:00
parent 51d43f809e
commit 4647ce2da5

View File

@ -151,7 +151,9 @@ osg::ref_ptr<EffectGeode> SGNewCloud::genCloud() {
float height = min_height + mt_rand(seed) * (max_height - min_height) - min_sprite_height;
if (width < 0.0) { width = 0.0; }
if (height < 0.0) { height = 0.0; }
// Protect against divide by 0 issues later when assigning index_y
if (height <= 0.0) { height = 0.01; }
// Determine appropriate shading factors
float top_factor = min_top_lighting_factor + mt_rand(seed) * (max_top_lighting_factor - min_top_lighting_factor);