Fix T56626: Cycles ambient occlusion only local : crash
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 31 Aug 2018 10:14:36 +0000 (12:14 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 31 Aug 2018 10:14:36 +0000 (12:14 +0200)
Was caused by missing NULL pointer check in BVH8.

intern/cycles/kernel/bvh/obvh_local.h

index 50bcfa79b6cae909282e7c7fda16bfc08ce19024..92143193a6a4b7090616893f0c45a129f60d560d 100644 (file)
@@ -50,7 +50,10 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
        int object = OBJECT_NONE;
        float isect_t = ray->t;
 
-       local_isect->num_hits = 0;
+       if(local_isect != NULL) {
+               local_isect->num_hits = 0;
+       }
+       kernel_assert((local_isect == NULL) == (max_hits == 0));
 
        const int object_flag = kernel_tex_fetch(__object_flag, local_object);
        if(!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {