Curves: Debug crash after switching to sculpt mode #117163

Merged
Pratik Borhade merged 1 commits from PratikPB2123/blender:curves-sculpt-mode into main 2024-01-17 12:20:39 +01:00
1 changed files with 5 additions and 2 deletions

View File

@ -818,8 +818,11 @@ static blender::float3 paint_init_pivot_mesh(Object *ob)
static blender::float3 paint_init_pivot_curves(Object *ob) static blender::float3 paint_init_pivot_curves(Object *ob)
{ {
const Curves &curves = *static_cast<const Curves *>(ob->data); const Curves &curves = *static_cast<const Curves *>(ob->data);
const blender::Bounds<blender::float3> bounds = *curves.geometry.wrap().bounds_min_max(); const std::optional<blender::Bounds<blender::float3>> bounds = curves.geometry.wrap().bounds_min_max();
return blender::math::midpoint(bounds.min, bounds.max); if (bounds.has_value()) {
return blender::math::midpoint(bounds->min, bounds->max);
}
return blender::float3(0);
} }
static blender::float3 paint_init_pivot_grease_pencil(Object *ob, const int frame) static blender::float3 paint_init_pivot_grease_pencil(Object *ob, const int frame)