nir/validate: fix crash if entry is null.
authorDave Airlie <airlied@redhat.com>
Mon, 20 May 2019 01:05:15 +0000 (11:05 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 20 May 2019 06:26:48 +0000 (16:26 +1000)
we validate assert entry just before this, but since that doesn't
stop execution, we need to check entry before the next validation
assert.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_validate.c

index 8278176564f19d9f89a92775c0b71810a320d38d..b087b0da12deb2a0167bfe18b1403f46fa7ea772 100644 (file)
@@ -388,7 +388,7 @@ validate_var_use(nir_variable *var, validate_state *state)
 {
    struct hash_entry *entry = _mesa_hash_table_search(state->var_defs, var);
    validate_assert(state, entry);
-   if (var->data.mode == nir_var_function_temp)
+   if (entry && var->data.mode == nir_var_function_temp)
       validate_assert(state, (nir_function_impl *) entry->data == state->impl);
 }