diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-12-13 15:27:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-12-13 15:48:17 +0300 |
commit | 8709cbb73e7d76970780efa2cb6084c881809e2b (patch) | |
tree | 9be8c4d4415b623a05e0e16dbbf1c8692de97a10 /source/blender/makesrna/intern/rna_access.c | |
parent | 1686979747c3b551ec91e8a3b1c7a9724ca381b2 (diff) |
Fix T93704: StructRNA.path_resolve fails silently with missing keys
Resolving the path to a missing pose-bone (for example),
was not raising an error as it should have.
Regression introduced in f9ccd26b037d43f2490d1f0263e45e775d30473d,
which didn't update collection lookup logic to fail in the case the
key of a collection wasn't found.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index ab9568aa3de..b64fa58cf6b 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4921,6 +4921,10 @@ static char *rna_path_token_in_brackets(const char **path, return buf; } +/** + * \return true when when the key in the path is correctly parsed and found in the collection + * or when the path is empty. + */ static bool rna_path_parse_collection_key(const char **path, PointerRNA *ptr, PropertyRNA *prop, @@ -4936,6 +4940,7 @@ static bool rna_path_parse_collection_key(const char **path, return true; } + bool found = false; if (**path == '[') { bool quoted; char *token; @@ -4950,7 +4955,7 @@ static bool rna_path_parse_collection_key(const char **path, /* check for "" to see if it is a string */ if (quoted) { if (RNA_property_collection_lookup_string(ptr, prop, token, r_nextptr)) { - /* pass */ + found = true; } else { r_nextptr->data = NULL; @@ -4963,7 +4968,7 @@ static bool rna_path_parse_collection_key(const char **path, return false; /* we can be sure the fixedbuf was used in this case */ } if (RNA_property_collection_lookup_int(ptr, prop, intkey, r_nextptr)) { - /* pass */ + found = true; } else { r_nextptr->data = NULL; @@ -4976,7 +4981,7 @@ static bool rna_path_parse_collection_key(const char **path, } else { if (RNA_property_collection_type_get(ptr, prop, r_nextptr)) { - /* pass */ + found = true; } else { /* ensure we quit on invalid values */ @@ -4984,7 +4989,7 @@ static bool rna_path_parse_collection_key(const char **path, } } - return true; + return found; } static bool rna_path_parse_array_index(const char **path, |