diff options
Diffstat (limited to 'Userland/Services/SpiceAgent/SpiceAgent.cpp')
-rw-r--r-- | Userland/Services/SpiceAgent/SpiceAgent.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Userland/Services/SpiceAgent/SpiceAgent.cpp b/Userland/Services/SpiceAgent/SpiceAgent.cpp index ce158cb31b..5d7f362c6a 100644 --- a/Userland/Services/SpiceAgent/SpiceAgent.cpp +++ b/Userland/Services/SpiceAgent/SpiceAgent.cpp @@ -140,17 +140,18 @@ void SpiceAgent::on_message_received() m_clipboard_connection.async_set_clipboard_data(anon_buffer, "text/plain", {}); return; } else { - RefPtr<Gfx::Bitmap> bitmap; + ErrorOr<Gfx::ImageFrameDescriptor> frame_or_error = Gfx::ImageFrameDescriptor {}; if (type == ClipboardType::PNG) { - bitmap = Gfx::PNGImageDecoderPlugin(data_buffer.data(), data_buffer.size()).frame(0).image; + frame_or_error = Gfx::PNGImageDecoderPlugin(data_buffer.data(), data_buffer.size()).frame(0); } else if (type == ClipboardType::BMP) { - bitmap = Gfx::BMPImageDecoderPlugin(data_buffer.data(), data_buffer.size()).frame(0).image; + frame_or_error = Gfx::BMPImageDecoderPlugin(data_buffer.data(), data_buffer.size()).frame(0); } else if (type == ClipboardType::JPG) { - bitmap = Gfx::JPGImageDecoderPlugin(data_buffer.data(), data_buffer.size()).frame(0).image; + frame_or_error = Gfx::JPGImageDecoderPlugin(data_buffer.data(), data_buffer.size()).frame(0); } else { dbgln("Unknown clipboard type: {}", (u32)type); return; } + auto const& bitmap = frame_or_error.value().image; m_clipboard_connection.set_bitmap(*bitmap); } break; |