[Bf-blender-cvs] [0f06de80724] master: Attributes: Add null check in color attribute duplicate operator

Hans Goudey noreply at git.blender.org
Tue Jun 14 16:42:06 CEST 2022


Commit: 0f06de807249d24bf6ba7713d41a5b23f0336b97
Author: Hans Goudey
Date:   Tue Jun 14 16:27:06 2022 +0200
Branches: master
https://developer.blender.org/rB0f06de807249d24bf6ba7713d41a5b23f0336b97

Attributes: Add null check in color attribute duplicate operator

It's potentially possible that the attribute duplication could fail,
for whetever reason. There is no great reason not to be safe in
this high-level code.

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

M	source/blender/editors/geometry/geometry_attributes.cc

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

diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc
index 79639097fbe..e880e0db76c 100644
--- a/source/blender/editors/geometry/geometry_attributes.cc
+++ b/source/blender/editors/geometry/geometry_attributes.cc
@@ -525,6 +525,9 @@ static int geometry_color_attribute_duplicate_exec(bContext *C, wmOperator *op)
   }
 
   CustomDataLayer *newLayer = BKE_id_attribute_duplicate(id, layer->name, op->reports);
+  if (newLayer == nullptr) {
+    return OPERATOR_CANCELLED;
+  }
 
   BKE_id_attributes_active_color_set(id, newLayer);



More information about the Bf-blender-cvs mailing list