1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:47:45 +00:00

LibCore: IODevice::can_read_line() should succeed for newline-less file

If the first call to populate_read_buffer() hits EOF but something did
get buffered, we can indeed read a line.
This commit is contained in:
Andreas Kling 2020-10-25 13:34:52 +01:00
parent 212aa85a55
commit 387607503c

View file

@ -130,6 +130,8 @@ bool IODevice::can_read_line() const
if (!can_read_from_fd())
return false;
populate_read_buffer();
if (m_eof && !m_buffered_data.is_empty())
return true;
return m_buffered_data.contains_slow('\n');
}