glsl: don't crash if a field is specified for a non-struct uniform
authorLuca Barbieri <luca@luca-barbieri.com>
Wed, 18 Aug 2010 10:52:56 +0000 (12:52 +0200)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 20 Aug 2010 20:01:07 +0000 (13:01 -0700)
This was triggered by the previous bug, but is a separate problem
in the general sense.

src/mesa/program/ir_to_mesa.cpp

index 1fbf574bc8b1d6b9c29ce5786eab3f9170570bd4..fe2d8982d0b36defc0f55c2c386db0cb25c147ed 100644 (file)
@@ -1145,7 +1145,7 @@ get_builtin_uniform_reg(struct gl_program *prog,
       if (!field && statevars[i].field) {
         assert(!"FINISHME: whole-structure state var dereference");
       }
-      if (field && strcmp(statevars[i].field, field) != 0)
+      if (field && (!statevars[i].field || strcmp(statevars[i].field, field) != 0))
         continue;
       break;
    }