diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2010-11-22 12:38:53 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2010-11-22 12:38:53 +0000 |
commit | 25551d44c1bc939e20fec7db81dfdb4198409b58 (patch) | |
tree | 910a91c8bca382de3d6607599202e2a41e9a7f87 | |
parent | 9604e021065e3e7cef6a09f66b787d580b089458 (diff) |
Fix off-by-one in Vector (the probable cause for many user-reported crashes?)
-rw-r--r-- | Vector.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -133,8 +133,8 @@ void Vector_insert(Vector* this, int idx, void* data_) { Vector_checkArraySize(this); assert(this->array[this->items] == NULL); - for (int i = this->items; i >= idx; i--) { - this->array[i+1] = this->array[i]; + for (int i = this->items; i > idx; i--) { + this->array[i] = this->array[i-1]; } this->array[idx] = data; this->items++; |