common/array: ++safety

do not try memory copy if the size is 0.
This commit is contained in:
Hermet Park 2024-05-09 11:28:27 +09:00
parent dcf6ebcf18
commit 13b46c41d2

View file

@ -61,6 +61,7 @@ struct Array
void push(Array<T>& rhs)
{
if (rhs.count == 0) return;
grow(rhs.count);
memcpy(data + count, rhs.data, rhs.count * sizeof(T));
count += rhs.count;