Try to avoid crashes if memory allocations fail

Deal with cases exceeding allocations of bodies/shapes above the limits set in b3Config
(work-in-progress )
This commit is contained in:
erwincoumans
2013-06-17 15:55:41 -07:00
parent e179d5882e
commit 561a44e5d8
8 changed files with 203 additions and 80 deletions

View File

@@ -303,7 +303,12 @@ protected:
{ // not enough room, reallocate
T* s = (T*)allocate(_Count);
b3Assert(s);
if (s==0)
{
b3Error("b3AlignedObjectArray reserve out-of-memory\n");
_Count=0;
m_size=0;
}
copy(0, size(), s);
destroy(0,size());