1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +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

@ -27,7 +27,10 @@ static constexpr StringView format_region = "\tBAR {}: {} region @ {:#x}";
static u32 read_hex_string_from_bytebuffer(ByteBuffer const& buf)
{
return AK::StringUtils::convert_to_uint_from_hex(String(buf.slice(2, buf.size() - 2).bytes())).release_value();
// FIXME: Propagate errors.
return AK::StringUtils::convert_to_uint_from_hex(
String(MUST(buf.slice(2, buf.size() - 2)).bytes()))
.release_value();
}
static u32 convert_sysfs_value_to_uint(String const& value)

View file

@ -132,7 +132,8 @@ private:
if (!m_buffer.is_empty()) {
auto size = OutputFileStream::write(m_buffer);
m_buffer = m_buffer.slice(size, m_buffer.size() - size);
// FIXME: Propagate errors.
m_buffer = MUST(m_buffer.slice(size, m_buffer.size() - size));
}
if (!m_buffer.is_empty())