diff --git a/include/reactphysics3d/containers/List.h b/include/reactphysics3d/containers/List.h index 140f0b56..2274657f 100755 --- a/include/reactphysics3d/containers/List.h +++ b/include/reactphysics3d/containers/List.h @@ -313,7 +313,7 @@ class List { void addWithoutInit(uint nbElements) { // If we need to allocate more memory - if (mSize == mCapacity) { + if ((mSize + nbElements) > mCapacity) { reserve(mCapacity == 0 ? nbElements : (mCapacity + nbElements) * 2); }