mirror of https://github.com/xzeldon/htop.git
Fix off-by-one in Vector (the probable cause for many user-reported crashes?)
This commit is contained in:
parent
9604e02106
commit
25551d44c1
4
Vector.c
4
Vector.c
|
@ -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++;
|
||||
|
|
Loading…
Reference in New Issue