mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Added Sanity Check for out of memory
This commit is contained in:
parent
378a933894
commit
a849202bde
|
|
@ -944,12 +944,22 @@ bool ReadFile(const Path &inPath, void *&outData, U32 &outSize, bool inNullTermi
|
|||
if ( inNullTerminate )
|
||||
{
|
||||
outData = new char [outSize+1];
|
||||
if( !outData )
|
||||
{
|
||||
// out of memory
|
||||
return false;
|
||||
}
|
||||
sizeRead = fileR->read(outData, outSize);
|
||||
static_cast<char *>(outData)[outSize] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
outData = new char [outSize];
|
||||
if( !outData )
|
||||
{
|
||||
// out of memory
|
||||
return false;
|
||||
}
|
||||
sizeRead = fileR->read(outData, outSize);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue