From 0f831dbcc720e177e2e4fa392b096b0d59b088d3 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Sun, 15 Jan 2023 14:07:08 +0000 Subject: [PATCH] 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. --- Userland/Applets/ClipboardHistory/main.cpp | 3 +++ 1 file changed, 3 insertions(+) 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 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()); });