mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:37:34 +00:00
AK/ByteBuffer+Everywhere: Handle errors in ByteBuffer::slice()
This commit is contained in:
parent
c0486f93d4
commit
c10d48b72c
12 changed files with 45 additions and 34 deletions
|
@ -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)
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue