]> git.mxchange.org Git - simgear.git/commitdiff
Ensure uniform are there before trying to use them
authorFrederic Bouvier <fredfgfs01@free.fr>
Sat, 14 Apr 2012 16:00:42 +0000 (18:00 +0200)
committerFrederic Bouvier <fredfgfs01@free.fr>
Sat, 14 Apr 2012 16:00:42 +0000 (18:00 +0200)
simgear/scene/model/SGLightAnimation.cxx

index 930d2db26302052f8de25267ca950bbb0a0cbc62..e2f25d96f346f140616f5d502651b6285f7a1021 100644 (file)
@@ -72,11 +72,14 @@ public:
                     BOOST_FOREACH(osg::ref_ptr<simgear::Pass>& pass, technique->passes)
                     {
                         osg::Uniform* amb = pass->getUniform("Ambient");
-                        amb->set(toOsg(_ambient) * dim);
+                        if (amb)
+                            amb->set(toOsg(_ambient) * dim);
                         osg::Uniform* dif = pass->getUniform("Diffuse");
-                        dif->set(toOsg(_diffuse) * dim);
+                        if (dif)
+                            dif->set(toOsg(_diffuse) * dim);
                         osg::Uniform* spe = pass->getUniform("Specular");
-                        spe->set(toOsg(_specular) * dim);
+                        if (spe)
+                            spe->set(toOsg(_specular) * dim);
                     }
                 }
             }