mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 21:00:16 +01:00
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 <bas@basnieuwenhuizen.nl>
This commit is contained in:
parent
add72599d9
commit
99ff7a9f1f
1 changed files with 1 additions and 1 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue