mirror of
https://github.com/reactos/CMake.git
synced 2024-11-25 04:29:52 +00:00
Fix crash on Windows. If input stream is no good, do not try to read a line from it. Return false and an empty line instead...
This commit is contained in:
parent
023889cb2c
commit
9578bfc0ef
@ -3959,10 +3959,11 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
|
||||
line = "";
|
||||
|
||||
long leftToRead = sizeLimit;
|
||||
|
||||
|
||||
// If no characters are read from the stream, the end of file has
|
||||
// been reached. Clear the fail bit just before reading.
|
||||
while(!haveNewline &&
|
||||
while(is &&
|
||||
!haveNewline &&
|
||||
leftToRead != 0 &&
|
||||
(is.clear(is.rdstate() & ~kwsys_ios::ios::failbit),
|
||||
is.getline(buffer, bufferSize), is.gcount() > 0))
|
||||
|
Loading…
Reference in New Issue
Block a user