diff --git a/CHANGELOG.md b/CHANGELOG.md index ab69d18a..9af6a45a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed +- Issue [#377](https://github.com/DanielChappuis/reactphysics3d/issues/377) Fix assert when destroying an empty PhysicsWorld - Issue [#378](https://github.com/DanielChappuis/reactphysics3d/issues/378) Fix issue with raycasting of HeightFieldShape - Fix crash within testbed application in raycasting scene diff --git a/include/reactphysics3d/containers/Deque.h b/include/reactphysics3d/containers/Deque.h index 7658c1b5..2a7977b1 100644 --- a/include/reactphysics3d/containers/Deque.h +++ b/include/reactphysics3d/containers/Deque.h @@ -296,8 +296,13 @@ class Deque { clear(); - // Release the chunks array - mAllocator.release(mBuffer, sizeof(T) * mCapacity); + if (mCapacity > 0) { + + assert(mBuffer != nullptr); + + // Release the chunks array + mAllocator.release(mBuffer, sizeof(T) * mCapacity); + } mCapacity = 0; mBuffer = nullptr;