From 0f06de807249d24bf6ba7713d41a5b23f0336b97 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 14 Jun 2022 16:27:06 +0200 Subject: [PATCH] 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. --- source/blender/editors/geometry/geometry_attributes.cc | 3 +++ 1 file changed, 3 insertions(+) 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);