Fix: crash when converting zero legacy curves

The issue was that the "radius" lookup below fails, because there is no
curve data. Arguably, it should be possible to add attributes even when
there is no data. However, the rules for that are a bit loose currently.
A simple fix is to just not run the conversion code when there is nothing
to convert.
This commit is contained in:
Jacques Lucke 2022-06-25 19:17:08 +02:00
parent b513c89e84
commit 3237c6dbe8
1 changed files with 4 additions and 0 deletions

View File

@ -105,6 +105,10 @@ Curves *curve_legacy_to_curves(const Curve &curve_legacy, const ListBase &nurbs_
curves.update_curve_types();
if (curves.curves_num() == 0) {
return curves_id;
}
MutableSpan<float3> positions = curves.positions_for_write();
OutputAttribute_Typed<float> radius_attribute =
component.attribute_try_get_for_output_only<float>("radius", ATTR_DOMAIN_POINT);