diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2022-07-24 22:27:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-24 22:27:45 +0100 |
| commit | 02a8bba02e6d5a499781dcb362803533c34ab1f1 (patch) | |
| tree | 5aa0c61eed5fc1f6ed25d735641fb56246f6c806 /src/array.cpp | |
| parent | 6ea68869c934807f1ecdc411e58bdce6b64ee7e2 (diff) | |
| parent | a3afe617c218736563723fd1ab343f403bdd33f0 (diff) | |
Merge branch 'master' into fix/freebsd-syscall
Diffstat (limited to 'src/array.cpp')
| -rw-r--r-- | src/array.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/array.cpp b/src/array.cpp index c41125c6d..d08bd647f 100644 --- a/src/array.cpp +++ b/src/array.cpp @@ -77,15 +77,21 @@ template <typename T> Slice<T> slice_from_array(Array<T> const &a); template <typename T> Slice<T> slice_make(gbAllocator const &allocator, isize count) { + GB_ASSERT(count >= 0); Slice<T> s = {}; s.data = gb_alloc_array(allocator, T, count); + GB_ASSERT(s.data != nullptr); s.count = count; return s; } template <typename T> void slice_init(Slice<T> *s, gbAllocator const &allocator, isize count) { + GB_ASSERT(count >= 0); s->data = gb_alloc_array(allocator, T, count); + if (count > 0) { + GB_ASSERT(s->data != nullptr); + } s->count = count; } |