Fix possible crash when loading project files

This fixes a crash when loading project files that haven't set the
current tab to the Browse Data tab.

See issue #1019.
This commit is contained in:
Martin Kleusberg
2017-06-26 12:39:50 +02:00
parent 004f715828
commit f4fad4afcf

View File

@@ -1964,11 +1964,14 @@ bool MainWindow::loadProject(QString filename, bool readOnly)
QByteArray temp = QByteArray::fromBase64(attrData.toUtf8());
QDataStream stream(temp);
stream >> browseTableSettings;
populateTable(); // Refresh view
ui->dataTable->sortByColumn(browseTableSettings[ui->comboBrowseTable->currentText()].sortOrderIndex,
browseTableSettings[ui->comboBrowseTable->currentText()].sortOrderMode);
showRowidColumn(browseTableSettings[ui->comboBrowseTable->currentText()].showRowid);
unlockViewEditing(!browseTableSettings[ui->comboBrowseTable->currentText()].unlockViewPk.isEmpty(), browseTableSettings[ui->comboBrowseTable->currentText()].unlockViewPk);
if(ui->mainTab->currentIndex() == BrowseTab)
{
populateTable(); // Refresh view
ui->dataTable->sortByColumn(browseTableSettings[ui->comboBrowseTable->currentText()].sortOrderIndex,
browseTableSettings[ui->comboBrowseTable->currentText()].sortOrderMode);
showRowidColumn(browseTableSettings[ui->comboBrowseTable->currentText()].showRowid);
unlockViewEditing(!browseTableSettings[ui->comboBrowseTable->currentText()].unlockViewPk.isEmpty(), browseTableSettings[ui->comboBrowseTable->currentText()].unlockViewPk);
}
xml.skipCurrentElement();
}
}