summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Clipboard.cpp
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/Libraries/LibGUI/Clipboard.cpp
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/Libraries/LibGUI/Clipboard.cpp')
-rw-r--r--Userland/Libraries/LibGUI/Clipboard.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/Clipboard.cpp b/Userland/Libraries/LibGUI/Clipboard.cpp
index 422acbcd73..a65281af1b 100644
--- a/Userland/Libraries/LibGUI/Clipboard.cpp
+++ b/Userland/Libraries/LibGUI/Clipboard.cpp
@@ -94,9 +94,12 @@ RefPtr<Gfx::Bitmap> Clipboard::bitmap() const
auto clipping_bitmap_or_error = Gfx::Bitmap::try_create_wrapper((Gfx::BitmapFormat)format.value(), { (int)width.value(), (int)height.value() }, scale.value(), pitch.value(), clipping.data.data());
if (clipping_bitmap_or_error.is_error())
return nullptr;
- auto clipping_bitmap = clipping_bitmap_or_error.release_value();
+ auto clipping_bitmap = clipping_bitmap_or_error.release_value_but_fixme_should_propagate_errors();
- 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) {