Fix: Zero division exception in ca60419b3a

Pull Request: https://projects.blender.org/blender/blender/pulls/144770
This commit is contained in:
илья _
2025-08-19 10:00:41 +02:00
committed by Thomas Dinges
parent c80834fbf7
commit 3a6a663a15

View File

@@ -1353,7 +1353,8 @@ void normals_calc_corners(const Span<float3> vert_positions,
}
const int64_t mean_size = space_offsets.total_size() / space_offsets.size();
const int64_t grain_size = math::clamp<int64_t>((1024 * 512) / mean_size, 256, 1024 * 16);
const int64_t grain_size = math::clamp<int64_t>(
math::safe_divide<int64_t>(1024 * 512, mean_size), 256, 1024 * 16);
threading::parallel_for(all_space_groups.index_range(), grain_size, [&](const IndexRange range) {
for (const int thread_i : range) {
Vector<CornerSpaceGroup, 0> &local_space_groups = all_space_groups[thread_i];