summaryrefslogtreecommitdiff
path: root/Userland/Applets
diff options
context:
space:
mode:
authorTim Ledbetter <timledbetter@gmail.com>2023-01-15 14:07:08 +0000
committerJelle Raaijmakers <jelle@gmta.nl>2023-01-15 19:19:06 +0100
commit0f831dbcc720e177e2e4fa392b096b0d59b088d3 (patch)
treea20fe24562cc253388d4c1a92bbfa1df81bdf7a3 /Userland/Applets
parent810c23b4220756fab6bdaae9e5be2b6891005847 (diff)
downloadserenity-0f831dbcc720e177e2e4fa392b096b0d59b088d3.zip
ClipboardHistory: Don't attempt to delete an item if nothing is selected
This prevents a crash if the delete action is invoked using the delete key while nothing is selected.
Diffstat (limited to 'Userland/Applets')
-rw-r--r--Userland/Applets/ClipboardHistory/main.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Applets/ClipboardHistory/main.cpp b/Userland/Applets/ClipboardHistory/main.cpp
index cc2ed9a054..e8858a67dc 100644
--- a/Userland/Applets/ClipboardHistory/main.cpp
+++ b/Userland/Applets/ClipboardHistory/main.cpp
@@ -43,6 +43,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
auto delete_action = GUI::CommonActions::make_delete_action([&](const GUI::Action&) {
+ if (table_view->selection().is_empty())
+ return;
+
model->remove_item(table_view->selection().first().row());
});