First check, then convert

This commit is contained in:
Dmitry-Me 2015-05-07 09:41:39 +03:00
parent 89df56c046
commit 72801b8b20
1 changed files with 2 additions and 2 deletions

View File

@ -1852,12 +1852,12 @@ XMLError XMLDocument::LoadFile( FILE* fp )
return _errorID;
}
const size_t size = filelength;
if ( size == 0 ) {
if ( filelength == 0 ) {
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
return _errorID;
}
const size_t size = filelength;
_charBuffer = new char[size+1];
size_t read = fread( _charBuffer, 1, size, fp );
if ( read != size ) {