Clamp currentIndex from Qt which can come back as -1 in some cases

* If this gets propagated far enough and used as an index it can cause
  crashes, so we clamp to 0 when we know the value should be
  non-negative.
This commit is contained in:
baldurk
2017-10-24 12:56:31 +01:00
parent 5e6ff6a276
commit 1e41875479
5 changed files with 20 additions and 20 deletions
@@ -149,7 +149,7 @@ void EnvironmentEditor::on_addUpdate_clicked()
EnvironmentModification mod;
mod.name = ui->name->text().toUtf8().data();
mod.value = ui->value->text().toUtf8().data();
mod.sep = (EnvSep)ui->separator->currentIndex();
mod.sep = (EnvSep)qMax(0, ui->separator->currentIndex());
if(ui->appendValue->isChecked())
mod.mod = EnvMod::Append;