diff --git a/Libraries/LibCore/CIODevice.cpp b/Libraries/LibCore/CIODevice.cpp index 6b7f042f8b..2098d7ee5a 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(); }