Add safety to satisfy Coverity on some errors that are likely impossible

* Reported by Coverity Scan
This commit is contained in:
baldurk
2017-11-22 12:21:46 +00:00
parent 25ea14c965
commit 9e5cfa8b96
15 changed files with 142 additions and 94 deletions
@@ -170,7 +170,12 @@ void EnvironmentEditor::on_deleteButton_clicked()
if(!sel)
return;
delete ui->variables->takeTopLevelItem(ui->variables->indexOfTopLevelItem(sel));
int idx = ui->variables->indexOfTopLevelItem(sel);
if(idx >= 0)
delete ui->variables->takeTopLevelItem(idx);
else
qCritical() << "Can't find item to delete";
on_name_textChanged(ui->name->text());
}