Fix automatic loading of connections on start up. Shouldn't crash

now...
This commit is contained in:
Collin Kidder
2019-02-17 15:15:48 -05:00
parent f6269dd5f4
commit 3291869849
3 changed files with 12 additions and 4 deletions
+4 -1
View File
@@ -42,7 +42,7 @@ ConnectionWindow::ConnectionWindow(QWidget *parent) :
ui->lineSend->setEnabled(false);
/* load connection configuration */
//loadConnections();
loadConnections();
ui->rbSocketCAN->setEnabled(isSerialBusAvailable());
@@ -541,6 +541,9 @@ void ConnectionWindow::loadConnections()
QVector<QString> driverNames = settings.value("connections/driverNames").value<QVector<QString>>();
QVector<int> devTypes = settings.value("connections/types").value<QVector<int>>();
//don't load the connections if the three setting arrays above aren't all the same size.
if (portNames.count() != driverNames.count() || devTypes.count() != driverNames.count()) return;
for(int i = 0 ; i < portNames.count() ; i++)
{
CANConnection* conn_p = create((CANCon::type)devTypes[i], portNames[i], driverNames[i]);