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:
authorJulian Eisel <eiseljulian@gmail.com>2020-02-19 22:45:58 +0300
committerJulian Eisel <eiseljulian@gmail.com>2020-02-19 22:45:58 +0300
commit03a4d3c33f824f966675dbb8fe3b4d645dc88f42 (patch)
treeff2f0d58f7aab840f1e56ad0f29f5f81b4d11c32
parente37988fa2131f989056ee43c1efaeeae2ab5d08c (diff)
RNA: Fail makesrna if enum identifiers contain spaces
We could of course always add checks for more invalid characters, but I'd say they are more unlikely to happen.
-rw-r--r--source/blender/makesrna/intern/rna_define.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 73a59cbba11..4150daa0f63 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1832,8 +1832,18 @@ void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item
for (i = 0; item[i].identifier; i++) {
eprop->totitem++;
- if (item[i].identifier[0] && item[i].value == eprop->defaultvalue) {
- defaultfound = 1;
+ if (item[i].identifier[0]) {
+ if (strstr(item[i].identifier, " ")) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", enum identifiers must not contain spaces.",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
+ else if (item[i].value == eprop->defaultvalue) {
+ defaultfound = 1;
+ }
}
}