summaryrefslogtreecommitdiff
path: root/Userland/Services/SpiceAgent
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-06 19:30:59 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-08 00:35:27 +0100
commit0de33b3d6c3b61a960a8e0aca3a851b8896b7491 (patch)
treec3766a896465114e0bc5354ce3c6c32af2638a65 /Userland/Services/SpiceAgent
parent235f39e449ebffed26114c7166b0b632a3f2232e (diff)
downloadserenity-0de33b3d6c3b61a960a8e0aca3a851b8896b7491.zip
LibGfx: Use ErrorOr<T> for Bitmap::try_create()
Another one that was used in a fajillion places.
Diffstat (limited to 'Userland/Services/SpiceAgent')
-rw-r--r--Userland/Services/SpiceAgent/ClipboardServerConnection.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Services/SpiceAgent/ClipboardServerConnection.cpp b/Userland/Services/SpiceAgent/ClipboardServerConnection.cpp
index 0d1be465e9..93dfc83ed9 100644
--- a/Userland/Services/SpiceAgent/ClipboardServerConnection.cpp
+++ b/Userland/Services/SpiceAgent/ClipboardServerConnection.cpp
@@ -43,8 +43,10 @@ RefPtr<Gfx::Bitmap> ClipboardServerConnection::get_bitmap()
if (clipping_bitmap_or_error.is_error())
return nullptr;
auto clipping_bitmap = clipping_bitmap_or_error.release_value();
- auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { (int)width.value(), (int)height.value() }, scale.value());
-
+ auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { (int)width.value(), (int)height.value() }, scale.value());
+ if (bitmap_or_error.is_error())
+ return nullptr;
+ auto bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
for (int y = 0; y < clipping_bitmap->physical_height(); ++y) {
for (int x = 0; x < clipping_bitmap->physical_width(); ++x) {
auto pixel = clipping_bitmap->get_pixel(x, y);