diff --git a/Engine/source/core/volume.cpp b/Engine/source/core/volume.cpp index 05a139eeb..4c3c85b4e 100644 --- a/Engine/source/core/volume.cpp +++ b/Engine/source/core/volume.cpp @@ -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(outData)[outSize] = '\0'; } else { outData = new char [outSize]; + if( !outData ) + { + // out of memory + return false; + } sizeRead = fileR->read(outData, outSize); }