From 9d6e27c85c1eb37b5eb2c501c9039316465cbffc Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Tue, 19 Jun 2012 22:04:17 +0100 Subject: [PATCH] Do not attempt to reposition non-existant clouds. Defensive workaround to Issue 678. --- simgear/scene/sky/cloudfield.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/simgear/scene/sky/cloudfield.cxx b/simgear/scene/sky/cloudfield.cxx index 1d9ae9ea..18c7e8ef 100644 --- a/simgear/scene/sky/cloudfield.cxx +++ b/simgear/scene/sky/cloudfield.cxx @@ -130,6 +130,11 @@ bool SGCloudField::reposition( const SGVec3f& p, const SGVec3f& up, double lon, ++itr) { osg::ref_ptr pat = itr->second; + + if (pat == 0) { + continue; + } + osg::Vec3f currpos = field_transform->getPosition() + fta * pat->getPosition(); // Determine the vector from the new position to the cloud in cloud-space. @@ -367,7 +372,7 @@ void SGCloudField::addCloudToTree(osg::ref_ptr t bool SGCloudField::deleteCloud(int identifier) { osg::ref_ptr transform = cloud_hash[identifier]; - if (transform == NULL) return false; + if (transform == 0) return false; removeCloudFromTree(transform); cloud_hash.erase(identifier); -- 2.39.5