summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp2
-rw-r--r--src/mesa/state_tracker/st_nir_lower_builtin.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 7f5a9afda8..5d05dbf0cc 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -198,7 +198,7 @@ st_nir_assign_uniform_locations(struct gl_program *prog,
* shader_program->UniformStorage[location]:
*/
uniform->data.location = val;
- } else if (strncmp(uniform->name, "gl_", 3) == 0) {
+ } else if (uniform->name && strncmp(uniform->name, "gl_", 3) == 0) {
const gl_state_index *const stateTokens = (gl_state_index *)uniform->state_slots[0].tokens;
/* This state reference has already been setup by ir_to_mesa, but we'll
* get the same index back here.
diff --git a/src/mesa/state_tracker/st_nir_lower_builtin.c b/src/mesa/state_tracker/st_nir_lower_builtin.c
index 19a8ac0313..30dafbfd64 100644
--- a/src/mesa/state_tracker/st_nir_lower_builtin.c
+++ b/src/mesa/state_tracker/st_nir_lower_builtin.c
@@ -168,7 +168,7 @@ lower_builtin_block(lower_builtin_state *state, nir_block *block)
continue;
/* built-in's will always start with "gl_" */
- if (strncmp(var->name, "gl_", 3) != 0)
+ if (!var->name || strncmp(var->name, "gl_", 3) != 0)
continue;
const struct gl_builtin_uniform_desc *desc =