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 94751654b4
commit 32bbd03672

View file

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