From 083c65ecd53ad52acab9e8a6665d7938c415bc8d Mon Sep 17 00:00:00 2001 From: David Williams Date: Sun, 24 Aug 2014 12:03:41 +0200 Subject: [PATCH] Added asserts. --- library/PolyVoxCore/include/PolyVoxCore/Impl/Array2D.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Array2D.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/Array2D.h index 3cac675c..751169c6 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/Array2D.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/Array2D.h @@ -50,11 +50,13 @@ namespace PolyVox ElementType operator()(uint32_t x, uint32_t y) const { + POLYVOX_ASSERT((x < m_uWidth && y < m_uHeight), "Array access is out-of-range."); return m_pData[y * m_uWidth + x]; } ElementType& operator()(uint32_t x, uint32_t y) { + POLYVOX_ASSERT((x < m_uWidth && y < m_uHeight), "Array access is out-of-range."); return m_pData[y * m_uWidth + x]; }