From 387607503ce1ff0e66f25dd1ddfb55e859952974 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 25 Oct 2020 13:34:52 +0100 Subject: [PATCH] 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. --- Libraries/LibCore/IODevice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/LibCore/IODevice.cpp b/Libraries/LibCore/IODevice.cpp index 22d4eb994b..63079c5721 100644 --- a/Libraries/LibCore/IODevice.cpp +++ b/Libraries/LibCore/IODevice.cpp @@ -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'); }