Fix RNA path resolving failing to lookup empty string properties
An empty string is a valid ID property name, when set, RNA's internal lookup function (rna_path_token_in_brackets), considered the path invalid. Now quoted tokens are allowed to be empty. This fixes Python exceptions being thrown in the custom property editor with empty custom property names.
This commit is contained in:
parent
e044c5f12b
commit
8df5205028
|
@ -125,9 +125,12 @@ static char *rna_path_token_in_brackets(const char **path,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Empty, return. */
|
/* Support empty strings in quotes, as this is a valid key for an ID-property. */
|
||||||
if (UNLIKELY(len == 0)) {
|
if (!quoted) {
|
||||||
return nullptr;
|
/* Empty, return. */
|
||||||
|
if (UNLIKELY(len == 0)) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to use fixed buffer if possible. */
|
/* Try to use fixed buffer if possible. */
|
||||||
|
|
|
@ -281,6 +281,8 @@ class TestRNAData(TestHelper, unittest.TestCase):
|
||||||
'[""]',
|
'[""]',
|
||||||
'["""]',
|
'["""]',
|
||||||
'[""""]',
|
'[""""]',
|
||||||
|
# Empty properties are also valid.
|
||||||
|
"",
|
||||||
)
|
)
|
||||||
for key_id in keys_to_test:
|
for key_id in keys_to_test:
|
||||||
self.id[key_id] = 1
|
self.id[key_id] = 1
|
||||||
|
|
Loading…
Reference in New Issue