diff options
author | 2006-12-08 23:31:36 +1000 | |
---|---|---|
committer | 2006-12-08 23:31:36 +1000 | |
commit | b156f083becf986a3f2ddac44ea28fb5cb91ce25 (patch) | |
tree | 822a1f85b17ebd65241391df64fde4a59714982e | |
parent | f83b754cd43bbc3321f70700e30a11faf0219a16 (diff) |
Fix off-by-one error making it impossible to edit the first element of an array using array slicing. Thanks to useer for reporting this bug.
darcs-hash:20061208133136-ac50b-3c8085ec61fcc3987356ee412133dba6c7f32d1f.gz
-rw-r--r-- | builtin_set.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin_set.c b/builtin_set.c index 650edf72..88e8fef9 100644 --- a/builtin_set.c +++ b/builtin_set.c @@ -274,11 +274,11 @@ static int update_values( array_list_t *list, { /* The '- 1' below is because the indices in fish are - one-based, but the array_lsit_t uses zero-based indices + one-based, but the array_list_t uses zero-based indices */ long ind = al_get_long(indexes, i) - 1; void *new = (void *) al_get(values, i); - if( ind <= 0 ) + if( ind < 0 ) { return 1; } |