Skip to content

Commit c3de835

Browse files
committed
Fix crash bug in graphing window when trying to edit graphs that don't
hvae a corresponding signal entry in a DBC file
1 parent 3c00204 commit c3de835

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

re/newgraphdialog.cpp

+32-29
Original file line numberDiff line numberDiff line change
@@ -227,51 +227,54 @@ void NewGraphDialog::setParams(GraphParams &params)
227227

228228
loadNodes();
229229

230-
auto msg = assocSignal->parentMessage;
231-
auto node = msg->sender;
232-
233-
bool nodeFound = false;
234-
for(int i=0; i<ui->cbNodes->count(); i++)
230+
if (assocSignal)
235231
{
236-
if(ui->cbNodes->itemText(i) == node->sourceFileName + Utility::fullyQualifiedNameSeperator + node->name)
237-
{
238-
ui->cbNodes->setCurrentIndex(i);
239-
nodeFound = true;
240-
break;
241-
}
242-
}
243-
244-
qDebug() << "Matching plot params to Node: " << nodeFound;
232+
auto msg = assocSignal->parentMessage;
233+
auto node = msg->sender;
245234

246-
if(nodeFound)
247-
{
248-
bool msgFound = false;
249-
for(int i=0; i<ui->cbMessages->count(); i++)
235+
bool nodeFound = false;
236+
for(int i=0; i<ui->cbNodes->count(); i++)
250237
{
251-
if(ui->cbMessages->itemText(i) == msg->name)
238+
if(ui->cbNodes->itemText(i) == node->sourceFileName + Utility::fullyQualifiedNameSeperator + node->name)
252239
{
253-
ui->cbMessages->setCurrentIndex(i);
254-
msgFound = true;
240+
ui->cbNodes->setCurrentIndex(i);
241+
nodeFound = true;
255242
break;
256243
}
257244
}
258245

259-
qDebug() << "Matching plot params to Msg: " << msgFound;
246+
qDebug() << "Matching plot params to Node: " << nodeFound;
260247

261-
if(msgFound)
248+
if(nodeFound)
262249
{
263-
bool sigFound = false;
264-
for(int i=0; i<ui->cbSignals->count(); i++)
250+
bool msgFound = false;
251+
for(int i=0; i<ui->cbMessages->count(); i++)
265252
{
266-
if(ui->cbSignals->itemText(i) == assocSignal->name)
253+
if(ui->cbMessages->itemText(i) == msg->name)
267254
{
268-
ui->cbSignals->setCurrentIndex(i);
269-
sigFound = true;
255+
ui->cbMessages->setCurrentIndex(i);
256+
msgFound = true;
270257
break;
271258
}
272259
}
273260

274-
qDebug() << "Matching plot params to Signal: " << sigFound;
261+
qDebug() << "Matching plot params to Msg: " << msgFound;
262+
263+
if(msgFound)
264+
{
265+
bool sigFound = false;
266+
for(int i=0; i<ui->cbSignals->count(); i++)
267+
{
268+
if(ui->cbSignals->itemText(i) == assocSignal->name)
269+
{
270+
ui->cbSignals->setCurrentIndex(i);
271+
sigFound = true;
272+
break;
273+
}
274+
}
275+
276+
qDebug() << "Matching plot params to Signal: " << sigFound;
277+
}
275278
}
276279
}
277280
//ui->cbNodes->model()->

0 commit comments

Comments
 (0)