Assert Vector_get returns an object

It is generally assumed Vector_get returns a non-NULL object.
Use a generic assert in Vector_get instead of in callers.
This commit is contained in:
Christian Göttsche
2020-10-31 20:57:22 +01:00
committed by cgzones
parent 742e610f1d
commit 0806a7958b
2 changed files with 2 additions and 3 deletions

View File

@ -65,8 +65,9 @@ int Vector_count(const Vector* this) {
}
Object* Vector_get(Vector* this, int idx) {
assert(idx < this->items);
assert(idx >= 0 && idx < this->items);
assert(Vector_isConsistent(this));
assert(this->array[idx]);
return this->array[idx];
}