]> git.mxchange.org Git - simgear.git/commitdiff
Do not attempt to reposition non-existant clouds.
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Tue, 19 Jun 2012 21:04:17 +0000 (22:04 +0100)
committerStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Tue, 19 Jun 2012 21:04:17 +0000 (22:04 +0100)
Defensive workaround to Issue 678.

simgear/scene/sky/cloudfield.cxx

index 1d9ae9ea98016f97d3af2887fcb923e7234a390a..18c7e8ef1d4ec6c38ead431ceb2585541d974237 100644 (file)
@@ -130,6 +130,11 @@ bool SGCloudField::reposition( const SGVec3f& p, const SGVec3f& up, double lon,
             ++itr) {
               
              osg::ref_ptr<osg::PositionAttitudeTransform> 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<osg::PositionAttitudeTransform> t
         
 bool SGCloudField::deleteCloud(int identifier) {
     osg::ref_ptr<osg::PositionAttitudeTransform> transform = cloud_hash[identifier];
-    if (transform == NULL) return false;
+    if (transform == 0) return false;
         
     removeCloudFromTree(transform);
     cloud_hash.erase(identifier);