diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-10-31 20:57:22 +0100 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2020-11-02 19:24:28 +0100 |
commit | 0806a7958b5b5ee29da043d3e4f3f854c164059d (patch) | |
tree | 4df792756fff5757429c6b3b118b2386838c4aa5 /Vector.c | |
parent | 742e610f1db4212d5bb5ca6ae56147fbf6f70f28 (diff) |
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.
Diffstat (limited to 'Vector.c')
-rw-r--r-- | Vector.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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]; } |