atArray: copy data only if not null (#123)

This commit is contained in:
Quentin 2023-07-17 16:54:32 +02:00 committed by GitHub
parent 249d3ad290
commit 5150441a5c

View File

@ -27,6 +27,12 @@ namespace rage
m_count = right.m_count;
m_size = right.m_size;
if (right.m_data == nullptr)
{
m_data = nullptr;
return;
}
m_data = (T*)tlsContext::get()->m_allocator->Allocate(m_size * sizeof(T), 16, 0);
std::uninitialized_copy(right.m_data, right.m_data + right.m_count, m_data);
}
@ -153,12 +159,12 @@ namespace rage
m_data = newOffset;
m_count = newSize;
}
#endif
void append(T value)
{
set(m_count, value);
}
#endif
T* begin() const
{