1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

ClipboardHistory: Fix crash when deleting without selection

* Fix by only activating the deletion action if we have a selection
This commit is contained in:
Simon Danner 2021-01-01 17:32:49 +01:00 committed by Andreas Kling
parent 3eca77bd86
commit 138c3c7d58

View file

@ -85,6 +85,7 @@ int main(int argc, char* argv[])
auto entry_context_menu = GUI::Menu::construct();
entry_context_menu->add_action(delete_action);
table_view.on_context_menu_request = [&](const GUI::ModelIndex&, const GUI::ContextMenuEvent& event) {
delete_action->set_enabled(!table_view.selection().is_empty());
entry_context_menu->popup(event.screen_position());
};