From cfc95b2dd1011c7c971315e6bf32084ddd392f78 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 5 Mar 2018 23:07:40 -0600 Subject: [PATCH] Add asserts to ox::fs::Ptr --- deps/ox/src/ox/fs/filestore/ptr.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deps/ox/src/ox/fs/filestore/ptr.hpp b/deps/ox/src/ox/fs/filestore/ptr.hpp index 5e453247..55bf1d27 100644 --- a/deps/ox/src/ox/fs/filestore/ptr.hpp +++ b/deps/ox/src/ox/fs/filestore/ptr.hpp @@ -71,6 +71,7 @@ inline size_t Ptr::offset() const { template inline T *Ptr::operator->() const { + ox_assert(valid(), "Invalid pointer access. (ox::fs::Ptr::operator->())"); return reinterpret_cast(m_dataStart + m_itemStart); } @@ -89,6 +90,7 @@ inline Ptr::operator size_t() const { template inline T &Ptr::operator*() const { + ox_assert(valid(), "Invalid pointer dereference. (ox::fs::Ptr::operator*())"); return *static_cast(this); }