[ox/fs] Fix segfault in FileAddress

This commit is contained in:
Gary Talent 2023-12-14 19:27:47 -06:00
parent ad7f696a71
commit 496afd66ea

View File

@ -45,9 +45,14 @@ FileAddress &FileAddress::operator=(const FileAddress &other) noexcept {
switch (m_type) { switch (m_type) {
case FileAddressType::Path: case FileAddressType::Path:
{ {
if (other.m_data.path) {
auto strSize = ox_strlen(other.m_data.path) + 1; auto strSize = ox_strlen(other.m_data.path) + 1;
m_data.path = new char[strSize]; m_data.path = new char[strSize];
ox_memcpy(m_data.path, other.m_data.path, strSize); ox_memcpy(m_data.path, other.m_data.path, strSize);
} else {
m_data.constPath = "";
m_type = FileAddressType::ConstPath;
}
break; break;
} }
case FileAddressType::ConstPath: case FileAddressType::ConstPath: