diff options
author | Bastien Montagne <bastien@blender.org> | 2022-05-16 11:58:51 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-05-16 11:58:51 +0300 |
commit | 2397287a51bf45f22b2008d17e8e89c2269d870a (patch) | |
tree | 1fde2a5bbc3ba413d3f720e4e41202cb9241a0ea /source/blender/makesrna/intern/rna_access.c | |
parent | b8de9916edaade33c55ba078c7b5c15555f20e7b (diff) |
Fix T96503: Assert using PropertyGroup and PointerProperty prop in Panel.
Wrong assert introduced in {rBad63d2f60e24}, added comment in code
explaining why NULL RNA pointer is a valid value to be skipped here.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 91bee19481c..8f7660d4015 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -5546,7 +5546,12 @@ static char *rna_idp_path(PointerRNA *ptr, if (iter->type == IDP_GROUP) { if (prop->type == PROP_POINTER) { PointerRNA child_ptr = RNA_property_pointer_get(ptr, prop); - BLI_assert(!RNA_pointer_is_null(&child_ptr)); + if (RNA_pointer_is_null(&child_ptr)) { + /* Pointer ID prop might be a 'leaf' in the IDProp group hierarchy, in which case a NULL + * value is perfectly valid. Just means it won't match the searched needle. */ + continue; + } + link.name = iter->name; link.index = -1; if ((path = rna_idp_path(&child_ptr, iter, needle, &link))) { @@ -5568,7 +5573,11 @@ static char *rna_idp_path(PointerRNA *ptr, for (j = 0; j < iter->len; j++, array++) { PointerRNA child_ptr; if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) { - BLI_assert(!RNA_pointer_is_null(&child_ptr)); + if (RNA_pointer_is_null(&child_ptr)) { + /* Array item ID prop might be a 'leaf' in the IDProp group hierarchy, in which case + * a NULL value is perfectly valid. Just means it won't match the searched needle. */ + continue; + } link.index = j; if ((path = rna_idp_path(&child_ptr, array, needle, &link))) { break; |