Skip to content

Commit 5ab03ed

Browse files
author
Dave Conway-Jones
committed
make sure blank msg from ui_tempate gets caught
1 parent 22f30db commit 5ab03ed

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- Fix navigation history, so back/formward browser buttons work. PR #587
1616
- Force socket.io to use secure link when using https.
1717
- Allow dropdowns to take up more space on screen for longer lists.
18+
- Make sure we don't fail on a null msg from a template.
1819

1920
### 2.21.0: Milestone Release
2021

dist/dashboard.appcache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# Time: Tue May 05 2020 12:16:30 GMT+0100 (British Summer Time)
2+
# Time: Thu May 07 2020 14:01:13 GMT+0100 (British Summer Time)
33

44
CACHE:
55
i18n.js

nodes/ui_template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ module.exports = function(RED) {
7575
return { msg:clonedMsg };
7676
},
7777
beforeSend: function (msg, original) {
78-
if (original) {
78+
if (original && original.hasOwnProperty("msg") && original.msg !== null) {
7979
var om = original.msg;
8080
om.socketid = original.socketid;
8181
return om;

ui.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,12 @@ function add(opt) {
285285
}
286286
var toSend = {payload:converted};
287287
toSend = opt.beforeSend(toSend, msg) || toSend;
288-
toSend.socketid = toSend.socketid || msg.socketid;
289-
if (toSend.hasOwnProperty("topic") && (toSend.topic === undefined)) { delete toSend.topic; }
290-
if (!msg.hasOwnProperty("_dontSend") && !msg.hasOwnProperty("_fromInput")) { // TODO: deprecate _fromInput
291-
opt.node.send(toSend); // send to following nodes
288+
if (toSend !== undefined) {
289+
toSend.socketid = toSend.socketid || msg.socketid;
290+
if (toSend.hasOwnProperty("topic") && (toSend.topic === undefined)) { delete toSend.topic; }
291+
if (!msg.hasOwnProperty("_dontSend") && !msg.hasOwnProperty("_fromInput")) { // TODO: deprecate _fromInput
292+
opt.node.send(toSend); // send to following nodes
293+
}
292294
}
293295
}
294296
if (opt.storeFrontEndInputAsState === true) {

0 commit comments

Comments
 (0)