Fix automatic loading of connections on start up. Shouldn't crash
now...
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user