Fix crash bug in graphing window when trying to edit graphs that don't

hvae a corresponding signal entry in a DBC file
This commit is contained in:
Collin Kidder
2023-11-21 21:04:56 -05:00
parent 3824111eb9
commit bf309130f3
+32 -29
View File
@@ -227,51 +227,54 @@ void NewGraphDialog::setParams(GraphParams &params)
loadNodes(); loadNodes();
auto msg = assocSignal->parentMessage; if (assocSignal)
auto node = msg->sender;
bool nodeFound = false;
for(int i=0; i<ui->cbNodes->count(); i++)
{ {
if(ui->cbNodes->itemText(i) == node->sourceFileName + Utility::fullyQualifiedNameSeperator + node->name) auto msg = assocSignal->parentMessage;
{ auto node = msg->sender;
ui->cbNodes->setCurrentIndex(i);
nodeFound = true;
break;
}
}
qDebug() << "Matching plot params to Node: " << nodeFound; bool nodeFound = false;
for(int i=0; i<ui->cbNodes->count(); i++)
if(nodeFound)
{
bool msgFound = false;
for(int i=0; i<ui->cbMessages->count(); i++)
{ {
if(ui->cbMessages->itemText(i) == msg->name) if(ui->cbNodes->itemText(i) == node->sourceFileName + Utility::fullyQualifiedNameSeperator + node->name)
{ {
ui->cbMessages->setCurrentIndex(i); ui->cbNodes->setCurrentIndex(i);
msgFound = true; nodeFound = true;
break; break;
} }
} }
qDebug() << "Matching plot params to Msg: " << msgFound; qDebug() << "Matching plot params to Node: " << nodeFound;
if(msgFound) if(nodeFound)
{ {
bool sigFound = false; bool msgFound = false;
for(int i=0; i<ui->cbSignals->count(); i++) for(int i=0; i<ui->cbMessages->count(); i++)
{ {
if(ui->cbSignals->itemText(i) == assocSignal->name) if(ui->cbMessages->itemText(i) == msg->name)
{ {
ui->cbSignals->setCurrentIndex(i); ui->cbMessages->setCurrentIndex(i);
sigFound = true; msgFound = true;
break; break;
} }
} }
qDebug() << "Matching plot params to Signal: " << sigFound; qDebug() << "Matching plot params to Msg: " << msgFound;
if(msgFound)
{
bool sigFound = false;
for(int i=0; i<ui->cbSignals->count(); i++)
{
if(ui->cbSignals->itemText(i) == assocSignal->name)
{
ui->cbSignals->setCurrentIndex(i);
sigFound = true;
break;
}
}
qDebug() << "Matching plot params to Signal: " << sigFound;
}
} }
} }
//ui->cbNodes->model()-> //ui->cbNodes->model()->