diff --git a/intern/cycles/kernel/bvh/obvh_local.h b/intern/cycles/kernel/bvh/obvh_local.h index 50bcfa79b6c..92143193a6a 100644 --- a/intern/cycles/kernel/bvh/obvh_local.h +++ b/intern/cycles/kernel/bvh/obvh_local.h @@ -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)) {