Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/python/intern/bpy_rna.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index cd607961788..58af86f077d 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -2241,6 +2241,7 @@ static void foreach_attr_type( BPy_PropertyRNA *self, char *attr,
*attr_tot= 0;
*attr_signed= FALSE;
+ /* note: this is fail with zero length lists, so dont let this get caled in that case */
RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
prop = RNA_struct_find_property(&itemptr, attr);
*raw_type= RNA_property_raw_type(prop);
@@ -2297,7 +2298,9 @@ static int foreach_parse_args(
#endif
}
- if (*size == 0) {
+ /* check 'attr_tot' otherwise we dont know if any values were set
+ * this isnt ideal because it means running on an empty list may fail silently when its not compatible. */
+ if (*size == 0 && *attr_tot != 0) {
PyErr_SetString( PyExc_AttributeError, "attribute does not support foreach method" );
return -1;
}