1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

LibCore: Use ErrorOr<T> in Core::AnonymousBuffer

This commit is contained in:
Andreas Kling 2021-11-06 01:20:51 +01:00
parent c4edb9f6c2
commit e2eabb4132
15 changed files with 56 additions and 53 deletions

View file

@ -193,7 +193,10 @@ bool decode(Decoder& decoder, Core::AnonymousBuffer& buffer)
if (!decoder.decode(anon_file))
return false;
buffer = Core::AnonymousBuffer::create_from_anon_fd(anon_file.take_fd(), size);
auto new_buffer_or_error = Core::AnonymousBuffer::create_from_anon_fd(anon_file.take_fd(), size);
if (new_buffer_or_error.is_error())
return false;
buffer = new_buffer_or_error.release_value();
return buffer.is_valid();
}