Merge pull request #4454 from node-red/4380-mqtt-undefined-value

Guard against node.broker being undefined
This commit is contained in:
Stephen McLaughlin 2023-11-27 17:48:02 +00:00 committed by GitHub
commit 6ec052be18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -612,7 +612,7 @@ module.exports = function(RED) {
node.brokerurl = node.url;
} else {
// if the broker is ws:// or wss:// or tcp://
if (node.broker.indexOf("://") > -1) {
if ((typeof node.broker === 'string') && node.broker.indexOf("://") > -1) {
node.brokerurl = node.broker;
// Only for ws or wss, check if proxy env var for additional configuration
if (node.brokerurl.indexOf("wss://") > -1 || node.brokerurl.indexOf("ws://") > -1) {