From 854db34385195a628b753256a4164207d1cc1db5 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 7 Oct 2025 12:21:01 +0200 Subject: [PATCH] Fix (unreported) `RNA_pointer_is_null` returning `true` on no-ID pointers. This behavior seems to have been there since initial implementation of this function in aed1320b24, 8 years ago. However, it is clearly wrong, and would return wrong positives in many cases (the Main RNA pointer itself is generated with a nullptr ID by `RNA_main_pointer_create`, and a _lot_ of code generates RNA pointers without any ID owner, as shown by a search e.g. on `RNA_pointer_create_discrete(nullptr`). WARNING: While logically correct, there is no real way to tell if this change is not going to break some weird corner case based on wrong assumption. in addition to unittests, this has also been checked against several production files. --- source/blender/makesrna/intern/rna_access.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_access.cc b/source/blender/makesrna/intern/rna_access.cc index 1c56bc9e073..814b078a7fa 100644 --- a/source/blender/makesrna/intern/rna_access.cc +++ b/source/blender/makesrna/intern/rna_access.cc @@ -241,7 +241,7 @@ PointerRNA RNA_pointer_create_from_ancestor(const PointerRNA &ptr, const int anc bool RNA_pointer_is_null(const PointerRNA *ptr) { - return (ptr->data == nullptr) || (ptr->owner_id == nullptr) || (ptr->type == nullptr); + return (ptr->data == nullptr) || (ptr->type == nullptr); } PointerRNA RNA_blender_rna_pointer_create()