Commit 25551d44 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

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

parent 9604e021
......@@ -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++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment