From 03d0040fe7936239c8f51988cb9fd36c8a5d05dd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 Nov 2012 09:38:18 +0000 Subject: [PATCH] patch [#32874] Fixed the property path calculation in situations where the link.index variable gets set during the search. From Florian K?\246berle --- source/blender/makesrna/intern/rna_access.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 1fe46342819..69332dcd250 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4011,12 +4011,15 @@ static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *nee BLI_assert(haystack->type == IDP_GROUP); link.up = parent_link; + /* always set both name and index, + * else a stale value might get used */ link.name = NULL; link.index = -1; for (i = 0, iter = haystack->data.group.first; iter; iter = iter->next, i++) { if (needle == iter) { /* found! */ link.name = iter->name; + link.index = -1; path = rna_idp_path_create(&link); break; } @@ -4026,6 +4029,7 @@ static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *nee PointerRNA child_ptr = RNA_pointer_get(ptr, iter->name); if (child_ptr.type) { link.name = iter->name; + link.index = -1; if ((path = rna_idp_path(&child_ptr, iter, needle, &link))) { break; }