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.
This commit is contained in:
Julian Eisel 2020-02-19 20:45:58 +01:00
parent e37988fa21
commit 03a4d3c33f
1 changed files with 12 additions and 2 deletions

View File

@ -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;
}
}
}