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

Kernel: Make DoubleBuffer::try() return KResultOr

This tidies up error propagation in a number of places.
This commit is contained in:
Andreas Kling 2021-09-07 13:46:11 +02:00
parent 213b8868af
commit 01993d0af3
8 changed files with 23 additions and 32 deletions

View file

@ -18,11 +18,11 @@ namespace Kernel {
RefPtr<MasterPTY> MasterPTY::try_create(unsigned int index)
{
auto buffer = DoubleBuffer::try_create();
if (!buffer)
auto buffer_or_error = DoubleBuffer::try_create();
if (buffer_or_error.is_error())
return {};
auto master_pty = adopt_ref_if_nonnull(new (nothrow) MasterPTY(index, buffer.release_nonnull()));
auto master_pty = adopt_ref_if_nonnull(new (nothrow) MasterPTY(index, buffer_or_error.release_value()));
if (!master_pty)
return {};