[Bf-blender-cvs] [f1f5144c9a9] soc-2022-many-lights-sampling: Fix: light tree crashes with no primitives

Jeffrey Liu noreply at git.blender.org
Sat Jul 9 06:57:06 CEST 2022


Commit: f1f5144c9a9ba5b7e3f9d051a1f4e08c5170f0e0
Author: Jeffrey Liu
Date:   Fri Jul 8 10:34:56 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBf1f5144c9a9ba5b7e3f9d051a1f4e08c5170f0e0

Fix: light tree crashes with no primitives

===================================================================

M	intern/cycles/scene/light_tree.cpp

===================================================================

diff --git a/intern/cycles/scene/light_tree.cpp b/intern/cycles/scene/light_tree.cpp
index 9496c865774..17a9e8ac8f4 100644
--- a/intern/cycles/scene/light_tree.cpp
+++ b/intern/cycles/scene/light_tree.cpp
@@ -246,6 +246,10 @@ void LightTreeBuildNode::init_interior(LightTreeBuildNode *c0, LightTreeBuildNod
 
 LightTree::LightTree(const vector<LightTreePrimitive> &prims, Scene *scene, uint max_lights_in_leaf)
 {
+  if (prims.size() == 0) {
+    return;
+  }
+
   prims_ = prims;
   scene_ = scene;
   max_lights_in_leaf_ = max_lights_in_leaf;



More information about the Bf-blender-cvs mailing list