mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
PixelPaint: Fix crash when copying empty selection
Previously, trying to copy when there is no selection would crash, trying to call mmap with a size of 0. Now it just leaves the clipboard as it is.
This commit is contained in:
parent
56cbd00e94
commit
bd4e88ae3d
1 changed files with 3 additions and 0 deletions
|
@ -92,6 +92,9 @@ void Layer::set_name(String name)
|
|||
|
||||
RefPtr<Gfx::Bitmap> Layer::try_copy_bitmap(Selection const& selection) const
|
||||
{
|
||||
if (selection.is_empty()) {
|
||||
return {};
|
||||
}
|
||||
auto selection_rect = selection.bounding_rect();
|
||||
|
||||
auto result = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, selection_rect.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue