aboutsummaryrefslogtreecommitdiff
path: root/src/array.cpp
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2022-04-27 14:37:15 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2022-04-27 14:37:15 +0200
commitc4e0d1efa1ec655bae9134b95a0fcd060cc7bbea (patch)
treec29bd0b78138e8d67aebe34ac689d13e32d9d15f /src/array.cpp
parent6e61abc7d06f22129f93110a9f652c3eec21f0c6 (diff)
parent9349dfba8fec53f52f77a0c8928e115ec93ff447 (diff)
Merge branch 'master' into xml
Diffstat (limited to 'src/array.cpp')
-rw-r--r--src/array.cpp6
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;
}