From 66c05fe3689fc41625532ddd2b6f049db4834d1d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 28 Aug 2023 13:16:24 +0200 Subject: [PATCH] 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! --- source/blender/makesrna/intern/rna_access.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/makesrna/intern/rna_access.cc b/source/blender/makesrna/intern/rna_access.cc index 30f8afa2c31..cf48a46976d 100644 --- a/source/blender/makesrna/intern/rna_access.cc +++ b/source/blender/makesrna/intern/rna_access.cc @@ -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);