Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-06-25 20:17:08 +0300
committerJacques Lucke <jacques@blender.org>2022-06-25 20:17:08 +0300
commit3237c6dbe877db1cfbe15e92f6cb267d8a6031ea (patch)
tree110b5b13af3c65a2fd601b2e36cf9837b4dbd69d /source/blender/blenkernel/intern/curve_legacy_convert.cc
parentb513c89e8450289746a7b3397bf3d610a0989d79 (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/curve_legacy_convert.cc')
-rw-r--r--source/blender/blenkernel/intern/curve_legacy_convert.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curve_legacy_convert.cc b/source/blender/blenkernel/intern/curve_legacy_convert.cc
index 62e89d8be80..193a292994d 100644
--- a/source/blender/blenkernel/intern/curve_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/curve_legacy_convert.cc
@@ -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);