[Bf-blender-cvs] [7083ea36e20] blender-v3.1-release: Fix T94085: Crash with empty stroke list

Campbell Barton noreply at git.blender.org
Tue Feb 15 09:49:36 CET 2022


Commit: 7083ea36e20a8364a37dc4a21d9a02002c80a8da
Author: Campbell Barton
Date:   Tue Feb 15 19:48:14 2022 +1100
Branches: blender-v3.1-release
https://developer.blender.org/rB7083ea36e20a8364a37dc4a21d9a02002c80a8da

Fix T94085: Crash with empty stroke list

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

M	source/blender/editors/curve/editcurve_paint.c

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

diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 403ace56e3b..e56eaeb8295 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -588,6 +588,14 @@ static bool curve_draw_init(bContext *C, wmOperator *op, bool is_invoke)
     cdd->vc.scene = CTX_data_scene(C);
     cdd->vc.view_layer = CTX_data_view_layer(C);
     cdd->vc.obedit = CTX_data_edit_object(C);
+
+    /* Using an empty stroke complicates logic later,
+     * it's simplest to disallow early on (see: T94085). */
+    if (RNA_collection_length(op->ptr, "stroke") == 0) {
+      MEM_freeN(cdd);
+      BKE_report(op->reports, RPT_ERROR, "The \"stroke\" cannot be empty");
+      return false;
+    }
   }
 
   op->customdata = cdd;



More information about the Bf-blender-cvs mailing list