Fix a regression introduced by Plorkyeran's iconv patch that caused the text file reader to throw an exception when trying to read an empty file.

Originally committed to SVN as r3146.
This commit is contained in:
Karl Blomster 2009-07-16 15:10:40 +00:00
parent c33ed91b12
commit 491fa10ff1
1 changed files with 2 additions and 0 deletions

View File

@ -133,6 +133,8 @@ wchar_t TextFileReader::GetWChar() {
file.read(inbuf, inbytesleft); file.read(inbuf, inbytesleft);
inbytesleft = file.gcount(); inbytesleft = file.gcount();
if (inbytesleft == 0)
return 0;
do { do {
size_t ret = iconv(conv, &inptr, &inbytesleft, reinterpret_cast<char **>(&outptr), &outbytesleft); size_t ret = iconv(conv, &inptr, &inbytesleft, reinterpret_cast<char **>(&outptr), &outbytesleft);