diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-09-06 03:29:52 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-06 01:53:26 +0200 |
commit | 97e97bccab085823d1365cb54142fd8c41dbcd8c (patch) | |
tree | 9008687dbcdfb6f36f6dc6372aa382b15b9d36c8 /Userland/Libraries/LibGUI | |
parent | 3a9f00c59bad7735970c72cb940d08161fda09b0 (diff) | |
download | serenity-97e97bccab085823d1365cb54142fd8c41dbcd8c.zip |
Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/Clipboard.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/Clipboard.cpp b/Userland/Libraries/LibGUI/Clipboard.cpp index 360afb2d21..2fdc5b1e3b 100644 --- a/Userland/Libraries/LibGUI/Clipboard.cpp +++ b/Userland/Libraries/LibGUI/Clipboard.cpp @@ -56,9 +56,12 @@ Clipboard::DataAndType Clipboard::data_and_type() const if (!response.data().is_valid()) return {}; auto data = ByteBuffer::copy(response.data().data<void>(), response.data().size()); + if (!data.has_value()) + return {}; + auto type = response.mime_type(); auto metadata = response.metadata().entries(); - return { data, type, metadata }; + return { data.release_value(), type, metadata }; } RefPtr<Gfx::Bitmap> Clipboard::bitmap() const |