If elems count is 0 when reading array, set resulting pointer to NULL

This commit is contained in:
baldurk
2015-08-31 17:11:16 +02:00
parent 2d12d5abee
commit 32b028e5a6
+6 -3
View File
@@ -364,11 +364,14 @@ class Serialiser
{
ReadInto(numElems);
if(el == NULL) el = new T[numElems];
if(numElems > 0)
{
if(el == NULL) el = new T[numElems];
size_t length = numElems*sizeof(T);
size_t length = numElems*sizeof(T);
memcpy(el, ReadBytes(length), length);
memcpy(el, ReadBytes(length), length);
}
}
Num = (size_t)numElems;