Don't try to delete empty Vectors.

This commit is contained in:
Bartosz Taudul 2019-11-10 17:54:50 +01:00
parent f2801491bf
commit 9504d6c68f

View File

@ -55,7 +55,7 @@ public:
tracy_force_inline ~Vector()
{
if( m_capacity != MaxCapacity() )
if( m_capacity != MaxCapacity() && m_ptr )
{
memUsage.fetch_sub( Capacity() * sizeof( T ), std::memory_order_relaxed );
delete[] (T*)m_ptr;
@ -65,7 +65,7 @@ public:
Vector& operator=( const Vector& ) = delete;
tracy_force_inline Vector& operator=( Vector&& src ) noexcept
{
if( m_capacity != MaxCapacity() )
if( m_capacity != MaxCapacity() && m_ptr )
{
memUsage.fetch_sub( Capacity() * sizeof( T ), std::memory_order_relaxed );
delete[] (T*)m_ptr;