Commit b76494a8 authored by David Cole's avatar David Cole

Better fix for crash on Windows. This time it will even work on Linux, too....

Better fix for crash on Windows. This time it will even work on Linux, too. That GetLineFromStream method while loop sure is fussy.
parent 7a9c0eea
......@@ -3960,10 +3960,22 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
long leftToRead = sizeLimit;
// Early short circuit return if stream is no good. Just return
// false and the empty line. (Probably means caller tried to
// create a file stream with a non-existent file name...)
//
if(!is)
{
if(has_newline)
{
*has_newline = false;
}
return false;
}
// If no characters are read from the stream, the end of file has
// been reached. Clear the fail bit just before reading.
while(is &&
!haveNewline &&
while(!haveNewline &&
leftToRead != 0 &&
(is.clear(is.rdstate() & ~kwsys_ios::ios::failbit),
is.getline(buffer, bufferSize), is.gcount() > 0))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment