Prevent crashing when removing the last plugin in the list

This commit is contained in:
morg 2025-01-10 10:56:03 +01:00
parent 59e303c882
commit 3e1a0ff5a3

View file

@ -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 |