From 976c1652cef8670edc9b43f26640d6c3473f6a73 Mon Sep 17 00:00:00 2001 From: Robbe Derks Date: Mon, 14 Feb 2022 15:55:27 +0100 Subject: [PATCH] fix setting comment on undefined msgs (#78) --- src/models/can/dbc.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/models/can/dbc.js b/src/models/can/dbc.js index 0c295eb..9bca846 100644 --- a/src/models/can/dbc.js +++ b/src/models/can/dbc.js @@ -450,6 +450,12 @@ export default class DBC { let [messageId, comment] = matches.slice(1); messageId = parseInt(messageId, 10); const msg = messages.get(messageId); + if (msg === undefined) { + warnings.push( + `failed to find message to add comment to, msg id: ${messageId}` + ); + continue; + } msg.comment = comment; if (hasFollowUp) {