[Bf-blender-cvs] [ad4d66580e8] blender-v3.0-release: Fix T93704: StructRNA.path_resolve fails silently with missing keys
Campbell Barton
noreply at git.blender.org
Tue Jan 11 09:32:58 CET 2022
Commit: ad4d66580e813bf58dbf32f3a0d6b850b91223b8
Author: Campbell Barton
Date: Mon Dec 13 23:27:07 2021 +1100
Branches: blender-v3.0-release
https://developer.blender.org/rBad4d66580e813bf58dbf32f3a0d6b850b91223b8
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.
===================================================================
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 40b5f3ed1da..025c1654098 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -4987,6 +4987,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,
@@ -5002,6 +5006,7 @@ static bool rna_path_parse_collection_key(const char **path,
return true;
}
+ bool found = false;
if (**path == '[') {
bool quoted;
char *token;
@@ -5016,7 +5021,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;
@@ -5029,7 +5034,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;
@@ -5042,7 +5047,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 */
@@ -5050,7 +5055,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,
More information about the Bf-blender-cvs
mailing list