Fix off-by-one in Vector (the probable cause for many user-reported crashes?)

This commit is contained in:
Hisham Muhammad 2010-11-22 12:38:53 +00:00
parent 9604e02106
commit 25551d44c1

View File

@ -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++;