diff --git a/include/neutx/container/detail/flat_data_store.hpp b/include/neutx/container/detail/flat_data_store.hpp index 4af01b4..c9f0a00 100644 --- a/include/neutx/container/detail/flat_data_store.hpp +++ b/include/neutx/container/detail/flat_data_store.hpp @@ -49,6 +49,9 @@ class flat_data_store { // convert abstract pointer to native pointer template T *native_pointer(pointer_t a_ptr) const { + if (!a_ptr) + return (T*)((char *)0); + if (a_ptr > m_size - sizeof(T)) throw std::invalid_argument("flat_data_store: bad offset"); return (T*)((char *)m_start + a_ptr);