commit | 72801b8b205b3bdc05fad696034b2f902b817b58 | [log] [tgz] |
---|---|---|
author | Dmitry-Me <wipedout@yandex.ru> | Thu May 07 09:41:39 2015 +0300 |
committer | Dmitry-Me <wipedout@yandex.ru> | Thu May 07 09:41:39 2015 +0300 |
tree | a8c511f95aed02a432a6b93fd63f84c5dc0f381b | |
parent | 89df56c0467ae4b53407698008a61369efff9a82 [diff] [blame] |
First check, then convert
diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 03ce1b9..6e1985b 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp
@@ -1852,12 +1852,12 @@ 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 ) {