Fix crash when trying to open non-existing table via command line

This fixes a crash when trying to open a table which does not exist via
the -t/--table command line parameter.

See issue #2180.
This commit is contained in:
Martin Kleusberg
2020-05-06 12:59:56 +02:00
parent d33e903b05
commit 112e008935

View File

@@ -582,7 +582,9 @@ void TableBrowser::reloadSettings()
void TableBrowser::setCurrentTable(const sqlb::ObjectIdentifier& name)
{
ui->comboBrowseTable->setCurrentIndex(ui->comboBrowseTable->findText(QString::fromStdString(name.toDisplayString())));
int index = ui->comboBrowseTable->findText(QString::fromStdString(name.toDisplayString()));
if(index != -1)
ui->comboBrowseTable->setCurrentIndex(index);
}
void TableBrowser::clear()