]> git.mxchange.org Git - simgear.git/commitdiff
osg::Uniform::get does not return a value on error.
authorThorstenB <brehmt@gmail.com>
Sun, 25 Mar 2012 13:11:50 +0000 (15:11 +0200)
committerThorstenB <brehmt@gmail.com>
Mon, 26 Mar 2012 19:00:10 +0000 (21:00 +0200)
Fixes "usage of uninitialized data" errors reported by valgrind.

simgear/scene/material/Effect.cxx

index a3064fdf1c95833d7a177195797b1f637f6381de..1645840725607d68b9f040becee05c15f6461de2 100644 (file)
@@ -998,8 +998,8 @@ struct UniformBuilder :public PassAttributeBuilder
         // optimize common uniforms
         if (uniformType == Uniform::SAMPLER_2D || uniformType == Uniform::INT)
         {
-            int val;
-            uniform->get(val);
+            int val = 0;
+            uniform->get(val); // 'val' remains unchanged in case of error (Uniform is a non-scalar)
             if (uniformType == Uniform::SAMPLER_2D && val == 0
                 && name == "texture") {
                 uniform = texture0;