From 491fa10ff1a0531e33cd5b44d3aa9afee11d7299 Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Thu, 16 Jul 2009 15:10:40 +0000 Subject: [PATCH] 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. --- aegisub/src/text_file_reader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aegisub/src/text_file_reader.cpp b/aegisub/src/text_file_reader.cpp index 04f6ea310..17fa4fe43 100644 --- a/aegisub/src/text_file_reader.cpp +++ b/aegisub/src/text_file_reader.cpp @@ -133,6 +133,8 @@ wchar_t TextFileReader::GetWChar() { file.read(inbuf, inbytesleft); inbytesleft = file.gcount(); + if (inbytesleft == 0) + return 0; do { size_t ret = iconv(conv, &inptr, &inbytesleft, reinterpret_cast(&outptr), &outbytesleft);