nir: Handle NULL in nir_copy_deref()
authorKristian Høgsberg Kristensen <krh@bitplanet.net>
Tue, 10 May 2016 22:08:38 +0000 (15:08 -0700)
committerKristian Høgsberg Kristensen <krh@bitplanet.net>
Tue, 24 May 2016 17:14:56 +0000 (10:14 -0700)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir.c

index c9db52ff23d9e151bdd9b39134cb438f71416fac..2741eb6581b7e156bec4f4a31bf1158727c46a78 100644 (file)
@@ -642,6 +642,9 @@ copy_deref_struct(void *mem_ctx, nir_deref_struct *deref)
 nir_deref *
 nir_copy_deref(void *mem_ctx, nir_deref *deref)
 {
+   if (deref == NULL)
+      return NULL;
+
    switch (deref->deref_type) {
    case nir_deref_type_var:
       return &copy_deref_var(mem_ctx, nir_deref_as_var(deref))->deref;