diff --git a/include/mitsuba/core/octree.h b/include/mitsuba/core/octree.h index 047a074f..fa9f6b85 100644 --- a/include/mitsuba/core/octree.h +++ b/include/mitsuba/core/octree.h @@ -140,7 +140,7 @@ public: perm[i] = i; /* Build the kd-tree and compute a suitable permutation of the elements */ - m_root = build(m_aabb, 0, &perm[0], &temp[0], &perm[0], &perm[m_items.size()-1]); + m_root = build(m_aabb, 0, &perm[0], &temp[0], &perm[0], &perm[0] + m_items.size()); /* Apply the permutation */ permute_inplace(&m_items[0], perm);