Skip to content

Commit 769ef0f

Browse files
author
Remigiusz Kołłątaj
committed
Fix CanSignalSender crash when signal list is empty for specific msg id
Signed-off-by: Remigiusz Kołłątaj <[email protected]>
1 parent c3fac17 commit 769ef0f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/cansignalsender/gui/cansignalsenderguiimpl.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ class SigIdDelegate : public QStyledItemDelegate {
4949

5050
if (_db.getDb().count(id)) {
5151
auto ndx = _model->index(index.row(), 1);
52-
_model->setData(ndx, _db.getDb().at(id).front().signal_name.c_str(), Qt::EditRole);
52+
auto& sigVec = _db.getDb().at(id);
53+
54+
if (sigVec.size()) {
55+
_model->setData(ndx, sigVec.front().signal_name.c_str(), Qt::EditRole);
56+
} else {
57+
_model->setData(ndx, "", Qt::EditRole);
58+
cds_error("No signals found for message {}", text.toStdString());
59+
}
5360
} else {
5461
cds_error("No signals for selected id 0x{:03x}", id);
5562
}

0 commit comments

Comments
 (0)