mirror of https://github.com/AxioDL/tinyxml2.git
First check, then convert
This commit is contained in:
parent
89df56c046
commit
72801b8b20
|
@ -1852,12 +1852,12 @@ XMLError XMLDocument::LoadFile( FILE* fp )
|
||||||
return _errorID;
|
return _errorID;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t size = filelength;
|
if ( filelength == 0 ) {
|
||||||
if ( size == 0 ) {
|
|
||||||
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
|
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
|
||||||
return _errorID;
|
return _errorID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t size = filelength;
|
||||||
_charBuffer = new char[size+1];
|
_charBuffer = new char[size+1];
|
||||||
size_t read = fread( _charBuffer, 1, size, fp );
|
size_t read = fread( _charBuffer, 1, size, fp );
|
||||||
if ( read != size ) {
|
if ( read != size ) {
|
||||||
|
|
Loading…
Reference in New Issue