[Bf-blender-cvs] [3237c6dbe87] master: Fix: crash when converting zero legacy curves

Jacques Lucke noreply at git.blender.org
Sat Jun 25 19:17:22 CEST 2022


Commit: 3237c6dbe877db1cfbe15e92f6cb267d8a6031ea
Author: Jacques Lucke
Date:   Sat Jun 25 19:17:08 2022 +0200
Branches: master
https://developer.blender.org/rB3237c6dbe877db1cfbe15e92f6cb267d8a6031ea

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.

===================================================================

M	source/blender/blenkernel/intern/curve_legacy_convert.cc

===================================================================

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);



More information about the Bf-blender-cvs mailing list