--Bug fixes

-Attempt to fix a null termination bug when reading Xml strings.
This commit is contained in:
Person 2024-03-04 07:49:22 -07:00
parent 960f0e11be
commit 47808b567d

View File

@ -336,7 +336,7 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
ifs.seekg(0, ios::beg);
ifs.read(&buf[0], pos);
if (nullTerminate)//Optionally NULL terminate if they want to treat it as a string.
if (nullTerminate && (buf[buf.size() - 1] != 0))//Optionally NULL terminate if they want to treat it as a string, and it's not terminated arleady.
buf[buf.size() - 1] = 0;
return true;