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:
Diffstat (limited to 'source/blender/editors/animation/drivers.c')
-rw-r--r--source/blender/editors/animation/drivers.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 0c2fa0878be..a91e67ffc91 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -147,7 +147,7 @@ short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short fla
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
FCurve *fcu;
- int array_index_max = array_index+1;
+ int array_index_max;
int done = 0;
/* validate pointer first - exit if failure */
@@ -159,9 +159,15 @@ short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short fla
/* key entire array convenience method */
if (array_index == -1) {
- array_index= 0;
array_index_max= RNA_property_array_length(&ptr, prop);
+ array_index= 0;
}
+ else
+ array_index_max= array_index;
+
+ /* maximum index should be greater than the start index */
+ if (array_index == array_index_max)
+ array_index_max += 1;
/* will only loop once unless the array index was -1 */
for (; array_index < array_index_max; array_index++) {