Fix RNA collection accessor (string search) not checking for null key pointer.

While in a way one could argue calling code could check for such case,
in practice it is way handier for the search code itself to just return
'not found' value in such case, rather than crash!
This commit is contained in:
Bastien Montagne 2023-08-28 13:16:24 +02:00
parent 47672bd06a
commit 66c05fe368
1 changed files with 6 additions and 0 deletions

View File

@ -4310,6 +4310,12 @@ int RNA_property_collection_lookup_string_index(
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
if (!key) {
*r_index = -1;
*r_ptr = PointerRNA_NULL;
return false;
}
if (cprop->lookupstring) {
/* we have a callback defined, use it */
return cprop->lookupstring(ptr, key, r_ptr);