Fixed a crashing bug in the signal editor
This commit is contained in:
@@ -281,6 +281,7 @@ DBC_MESSAGE *DBCHandler::findMsgByID(int id)
|
|||||||
|
|
||||||
DBC_SIGNAL *DBCHandler::findSignalByName(DBC_MESSAGE *msg, QString name)
|
DBC_SIGNAL *DBCHandler::findSignalByName(DBC_MESSAGE *msg, QString name)
|
||||||
{
|
{
|
||||||
|
if (msg == NULL) return NULL;
|
||||||
if (msg->msgSignals.length() == 0) return NULL;
|
if (msg->msgSignals.length() == 0) return NULL;
|
||||||
for (int i = 0; i < msg->msgSignals.length(); i++)
|
for (int i = 0; i < msg->msgSignals.length(); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-3
@@ -1,5 +1,6 @@
|
|||||||
#include "dbcsignaleditor.h"
|
#include "dbcsignaleditor.h"
|
||||||
#include "ui_dbcsignaleditor.h"
|
#include "ui_dbcsignaleditor.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) :
|
DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
@@ -63,9 +64,6 @@ void DBCSignalEditor::fillSignalForm(DBC_SIGNAL *sig)
|
|||||||
{
|
{
|
||||||
unsigned char bitpattern[8];
|
unsigned char bitpattern[8];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ui->txtName->setText(sig->name);
|
ui->txtName->setText(sig->name);
|
||||||
ui->txtBias->setText(QString::number(sig->bias));
|
ui->txtBias->setText(QString::number(sig->bias));
|
||||||
ui->txtBitLength->setText(QString::number(sig->signalSize));
|
ui->txtBitLength->setText(QString::number(sig->signalSize));
|
||||||
@@ -144,7 +142,10 @@ void DBCSignalEditor::fillValueTable(DBC_SIGNAL *sig)
|
|||||||
|
|
||||||
void DBCSignalEditor::clickSignalList(int row)
|
void DBCSignalEditor::clickSignalList(int row)
|
||||||
{
|
{
|
||||||
|
if (row < 0) return;
|
||||||
|
//qDebug() << ui->signalsList->item(row)->text();
|
||||||
DBC_SIGNAL *thisSig = dbcHandler->findSignalByName(dbcMessage, ui->signalsList->item(row)->text());
|
DBC_SIGNAL *thisSig = dbcHandler->findSignalByName(dbcMessage, ui->signalsList->item(row)->text());
|
||||||
|
if (thisSig == NULL) return;
|
||||||
fillSignalForm(thisSig);
|
fillSignalForm(thisSig);
|
||||||
fillValueTable(thisSig);
|
fillValueTable(thisSig);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user