From 38b75d2a97a8904d429818b18806faa2273ec92e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 11 Sep 2019 21:13:14 +0200 Subject: [PATCH] CIODevice: read(u8*, int) overload should return 0 on EOF --- Libraries/LibCore/CIODevice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/LibCore/CIODevice.cpp b/Libraries/LibCore/CIODevice.cpp index 6b7f042f8b5..2098d7ee5ae 100644 --- a/Libraries/LibCore/CIODevice.cpp +++ b/Libraries/LibCore/CIODevice.cpp @@ -25,6 +25,8 @@ const char* CIODevice::error_string() const int CIODevice::read(u8* buffer, int length) { auto read_buffer = read(length); + if (read_buffer.is_null()) + return 0; memcpy(buffer, read_buffer.data(), length); return read_buffer.size(); }