nvc0: fix crash when nv50_miptree_from_handle fails
authorJulien Isorce <j.isorce@samsung.com>
Tue, 20 Oct 2015 16:34:23 +0000 (17:34 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 28 Oct 2015 17:26:20 +0000 (18:26 +0100)
Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/nouveau/nvc0/nvc0_resource.c

index 12b5a025064869b426df63a69bebbddea7b5560b..15c803c430715d7f6b5aef7f3a36ade1140fdfc5 100644 (file)
@@ -26,7 +26,8 @@ nvc0_resource_from_handle(struct pipe_screen * screen,
    } else {
       struct pipe_resource *res = nv50_miptree_from_handle(screen,
                                                            templ, whandle);
-      nv04_resource(res)->vtbl = &nvc0_miptree_vtbl;
+      if (res)
+         nv04_resource(res)->vtbl = &nvc0_miptree_vtbl;
       return res;
    }
 }