Prevent String::Set from crashing if passed a nullptr

This commit is contained in:
Tim Wojtulewicz 2020-10-14 12:37:32 -07:00
parent ecd970ffde
commit b1e517e863

View file

@ -132,11 +132,14 @@ void String::Set(const char* str)
{
Reset();
n = strlen(str);
b = new u_char[n+1];
memcpy(b, str, n+1);
final_NUL = true;
use_free_to_delete = false;
if ( str )
{
n = strlen(str);
b = new u_char[n+1];
memcpy(b, str, n+1);
final_NUL = true;
use_free_to_delete = false;
}
}
void String::Set(const std::string& str)