Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Edwards <artfunkel>2022-08-29 22:45:55 +0300
committerHans Goudey <h.goudey@me.com>2022-08-29 22:45:55 +0300
commit35df9f80b9c73e851c28ac27511a50a6f4f41d5b (patch)
tree0db8af439301019487af17bb141ec2f158e545c7
parent68487cff95b335491e001ded8620b4b7aa3380db (diff)
Fix T99576: Guard against empty names when removing attributes
It's possible for misbehaving scripts written before 3.3 to reach this state and crash Blender. With this change, the error is reduced to a Python exception. Differential Revision: https://developer.blender.org/D15724
-rw-r--r--source/blender/blenkernel/intern/attribute.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc
index b6d39486313..495a2c82332 100644
--- a/source/blender/blenkernel/intern/attribute.cc
+++ b/source/blender/blenkernel/intern/attribute.cc
@@ -288,6 +288,10 @@ CustomDataLayer *BKE_id_attribute_duplicate(ID *id, const char *name, ReportList
bool BKE_id_attribute_remove(ID *id, const char *name, ReportList *reports)
{
using namespace blender::bke;
+ if (!name || name[0] == '\0') {
+ BKE_report(reports, RPT_ERROR, "The attribute name must not be empty");
+ return false;
+ }
if (BKE_id_attribute_required(id, name)) {
BKE_report(reports, RPT_ERROR, "Attribute is required and can't be removed");
return false;