Fix segfaults when add to graphing window for signal not found in DBC
This commit is contained in:
+21
-1
@@ -535,6 +535,7 @@ void MainWindow::setupAddToNewGraph()
|
||||
setupSendToLatestGraphWindow(); //then call the other function to finish
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::setupSendToLatestGraphWindow()
|
||||
{
|
||||
if (!lastGraphingWindow) showGraphingWindow();
|
||||
@@ -542,7 +543,11 @@ void MainWindow::setupSendToLatestGraphWindow()
|
||||
QString signalName = getSignalNameFromPosition(contextMenuPosition);
|
||||
param.ID = getMessageIDFromPosition(contextMenuPosition);
|
||||
DBC_MESSAGE *msg = dbcHandler->findMessageForFilter(param.ID, nullptr);
|
||||
if(msg)
|
||||
{
|
||||
DBC_SIGNAL *sig = msg->sigHandler->findSignalByName(signalName);
|
||||
if(sig)
|
||||
{
|
||||
param.associatedSignal = sig;
|
||||
param.bias = sig->bias;
|
||||
param.intelFormat = sig->intelByteOrder;
|
||||
@@ -561,7 +566,22 @@ void MainWindow::setupSendToLatestGraphWindow()
|
||||
|
||||
lastGraphingWindow->createGraph(param); //add the new graph to the window
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
QMessageBox msgbox;
|
||||
QString boxmsg = "Cannot find ID 0x" + QStringLiteral("%1").arg(param.ID, 3, 16, QLatin1Char('0')) + " in DBC message " + msg->name + ". Not adding graph.";
|
||||
msgbox.setText(boxmsg);
|
||||
msgbox.exec();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox msgbox;
|
||||
QString boxmsg = "Cannot find ID 0x" + QStringLiteral("%1").arg(param.ID, 3, 16, QLatin1Char('0')) + " in DBC file(s). Not adding graph.";
|
||||
msgbox.setText(boxmsg);
|
||||
msgbox.exec();
|
||||
}
|
||||
}
|
||||
void MainWindow::interpretToggled(bool state)
|
||||
{
|
||||
model->setInterpretMode(state);
|
||||
|
||||
Reference in New Issue
Block a user