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
@@ -316,7 +316,7 @@ void SettingsDialog::on_EventBrowser_TimeUnit_currentIndexChanged(int index)
if(m_Init)
return;
m_Ctx.Config().EventBrowser_TimeUnit = (TimeUnit)ui->EventBrowser_TimeUnit->currentIndex();
m_Ctx.Config().EventBrowser_TimeUnit = (TimeUnit)qMax(0, ui->EventBrowser_TimeUnit->currentIndex());
if(m_Ctx.HasEventBrowser())
m_Ctx.GetEventBrowser()->UpdateDurationColumn();