From 3e1a0ff5a3f9b8ca4383870282c827bca9b77ee9 Mon Sep 17 00:00:00 2001 From: morg Date: Fri, 10 Jan 2025 10:56:03 +0100 Subject: [PATCH] Prevent crashing when removing the last plugin in the list --- qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp index b550c762..baff6cf8 100644 --- a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp +++ b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp @@ -350,6 +350,15 @@ void Ui::OpenRGBPluginsPage::on_PluginsList_itemSelectionChanged() \*-----------------------------------------------------*/ int cur_row = ui->PluginsList->currentRow(); + /*-----------------------------------------------------*\ + | Disable the remove button if no item selected | + \*-----------------------------------------------------*/ + if(cur_row == -1) + { + ui->RemovePluginButton->setEnabled(false); + return; + } + /*-----------------------------------------------------*\ | Enable the remove button when there's a selected item | | and the selected item is not a system plugin |