[Bf-blender-cvs] [2397287a51b] blender-v3.2-release: Fix T96503: Assert using PropertyGroup and PointerProperty prop in Panel.

Bastien Montagne noreply at git.blender.org
Mon May 16 11:00:51 CEST 2022


Commit: 2397287a51bf45f22b2008d17e8e89c2269d870a
Author: Bastien Montagne
Date:   Mon May 16 10:58:51 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB2397287a51bf45f22b2008d17e8e89c2269d870a

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.

===================================================================

M	source/blender/makesrna/intern/rna_access.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list