From 25a8a2baf4d9e85a557d71b95232a5fa0b165a4a Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 26 Jul 2025 18:31:41 -0500 Subject: [PATCH] [ox/std] Add null check for deallocating in consteval context Vector (synced from 92f74b27d16a99821cbb4b6c2e025c9ad9d45323) --- src/ox/std/vector.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ox/std/vector.hpp b/src/ox/std/vector.hpp index faab0650f..aa5706215 100644 --- a/src/ox/std/vector.hpp +++ b/src/ox/std/vector.hpp @@ -87,7 +87,9 @@ struct VectorAllocator { constexpr void deallocate(T *items, std::size_t cap) noexcept { // small vector optimization cannot be done it constexpr, but it doesn't really matter in constexpr if (std::is_constant_evaluated()) { - Allocator{}.deallocate(items, cap); + if (items) { + Allocator{}.deallocate(items, cap); + } } else { if (items && static_cast(items) != static_cast(m_data.data())) { Allocator{}.deallocate(items, cap);