mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3869 from Steve-Mcl/fix-mqtt-birth-bad-topic-crash
Prevent invalid mqtt birth topic crashing node-red
This commit is contained in:
commit
5b7e84c1b0
@ -998,13 +998,20 @@ module.exports = function(RED) {
|
||||
|
||||
if (topicOK) {
|
||||
node.client.publish(msg.topic, msg.payload, options, function (err) {
|
||||
done && done(err);
|
||||
return
|
||||
});
|
||||
if (done) {
|
||||
done(err)
|
||||
} else {
|
||||
const error = new Error(RED._("mqtt.errors.invalid-topic"));
|
||||
error.warn = true;
|
||||
done(error);
|
||||
node.error(err, msg)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const error = new Error(RED._("mqtt.errors.invalid-topic"))
|
||||
error.warn = true
|
||||
if (done) {
|
||||
done(error)
|
||||
} else {
|
||||
node.warn(error, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user