mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-26 23:11:34 +03:00
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.
This commit is contained in:
parent
810c23b422
commit
0f831dbcc7
Notes:
sideshowbarker
2024-07-17 08:43:11 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/0f831dbcc7 Pull-request: https://github.com/SerenityOS/serenity/pull/17017 Reviewed-by: https://github.com/gmta
@ -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());
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user