summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2017-06-26 17:07:21 -0700
committerConnor Abbott <[email protected]>2017-07-13 14:40:23 -0700
commit99ff7a9f1f08b2e3687946dec09b2c010540fa1d (patch)
tree6656de7457ec5ef998b4a3eb9fac7197fc912334 /src/compiler/nir
parentadd72599d9aba53753a311db13332531c3635176 (diff)
nir: don't segfault when printing variables with no name
While normally we give variables whose name field is NULL a temporary name when called from nir_print_shader(), when we were calling from nir_print_instr() we never bothered, meaning that we just segfaulted when trying to print out instructions with such a variable. Since nir_print_instr() is meant to be called while debugging, we don't need to bother too much about giving a consistent name, but we don't want to crash in the middle of debugging. Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_print.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 66c0669b594..f4811fe8bc1 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -257,7 +257,7 @@ static const char *
get_var_name(nir_variable *var, print_state *state)
{
if (state->ht == NULL)
- return var->name;
+ return var->name ? var->name : "unnamed";
assert(state->syms);