Merge pull request #3526 from node-red-hitachi/fix-status-reference-in-debug-node

fix reference error of msg.status in debug node
This commit is contained in:
Nick O'Leary 2022-04-20 10:56:25 +01:00 committed by GitHub
commit 4706e20a1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -108,7 +108,9 @@ module.exports = function(RED) {
}
})
this.on("input", function(msg, send, done) {
if (hasOwnProperty.call(msg, "status") && hasOwnProperty.call(msg.status, "source") && hasOwnProperty.call(msg.status.source, "id") && (msg.status.source.id === node.id)) {
if (hasOwnProperty.call(msg, "status") && msg.status &&
hasOwnProperty.call(msg.status, "source") && msg.status.source &&
hasOwnProperty.call(msg.status.source, "id") && (msg.status.source.id === node.id)) {
done();
return;
}
@ -129,7 +131,8 @@ module.exports = function(RED) {
fill = "red";
st = msg.error.message;
}
if (hasOwnProperty.call(msg, "status")) {
if (hasOwnProperty.call(msg, "status") &&
msg.status) {
fill = msg.status.fill || "grey";
shape = msg.status.shape || "ring";
st = msg.status.text || "";