From d567785658349504dc98c693c8c46c30e9a60c44 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 25 Jul 2022 13:16:59 +0200 Subject: Fix T99816: renaming attribute works incorrectly This fixes two issues: * There was a crash when the new attribute name was empty. * The attribute name was incremented (e.g. "Attribute.001") when the old and new name were the same. --- source/blender/blenkernel/intern/attribute.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source') diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc index ff40f842349..639e190a2c6 100644 --- a/source/blender/blenkernel/intern/attribute.cc +++ b/source/blender/blenkernel/intern/attribute.cc @@ -146,6 +146,13 @@ bool BKE_id_attribute_rename(ID *id, BLI_assert_msg(0, "Required attribute name is not editable"); return false; } + if (STREQ(new_name, "")) { + BKE_report(reports, RPT_ERROR, "Attribute name can not be empty"); + return false; + } + if (STREQ(old_name, new_name)) { + return false; + } CustomDataLayer *layer = BKE_id_attribute_search( id, old_name, CD_MASK_PROP_ALL, ATTR_DOMAIN_MASK_ALL); -- cgit v1.2.3