Commit f69aa680 authored by Ken Martin's avatar Ken Martin
Browse files

minor error checking

parent 26c8dc7b
......@@ -58,7 +58,10 @@ vlCharArray::vlCharArray(const int sz, const int ext)
vlCharArray::~vlCharArray()
{
delete [] this->Array;
if (this->Array)
{
delete [] this->Array;
}
}
// Description:
......@@ -141,11 +144,15 @@ unsigned char *vlCharArray::Resize(const int sz)
return 0;
}
memcpy(newArray, this->Array,
(sz < this->Size ? sz : this->Size) * sizeof(char));
if (this->Array)
{
memcpy(newArray, this->Array,
(sz < this->Size ? sz : this->Size) * sizeof(char));
delete [] this->Array;
}
this->Size = newSize;
delete [] this->Array;
this->Array = newArray;
return this->Array;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment