1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:08:10 +00:00

AK/ByteBuffer+Everywhere: Handle errors in ByteBuffer::slice()

This commit is contained in:
Matthias Zimmerman 2022-06-13 05:20:42 -07:00 committed by Linus Groh
parent c0486f93d4
commit c10d48b72c
12 changed files with 45 additions and 34 deletions

View file

@ -64,7 +64,8 @@ ByteBuffer Job::receive(size_t size)
{
ByteBuffer buffer = ByteBuffer::create_uninitialized(size).release_value_but_fixme_should_propagate_errors();
auto nread = MUST(m_socket->read(buffer)).size();
return buffer.slice(0, nread);
// FIXME: Propagate errors.
return MUST(buffer.slice(0, nread));
}
bool Job::can_read() const
@ -101,7 +102,8 @@ void Job::flush_received_buffers()
continue;
}
VERIFY(written < payload.size());
payload = payload.slice(written, payload.size() - written);
// FIXME: Propagate errors.
payload = MUST(payload.slice(written, payload.size() - written));
return;
}
}