escape some errors

This commit is contained in:
Dave Conway-Jones 2024-01-25 20:56:53 +00:00
parent 25e4134b51
commit 8d0bdfd985
No known key found for this signature in database
GPG Key ID: 1DDB0E91A28C2643
2 changed files with 3 additions and 3 deletions

View File

@ -188,7 +188,7 @@ module.exports = function(RED) {
if (RED.settings.verbose || LOGITALL) {that.log("got an iq query"); } if (RED.settings.verbose || LOGITALL) {that.log("got an iq query"); }
if (stanza.attrs.type === 'error') { if (stanza.attrs.type === 'error') {
if (RED.settings.verbose || LOGITALL) {that.log("oh noes, it's an error"); } if (RED.settings.verbose || LOGITALL) {that.log("oh noes, it's an error"); }
if (that && that.hasOwnProperty("lastUsed") && that.lastUsed.hasOwnProperty("id") && stanza.attrs.id === that.lastUsed.id) { if (that?.lastUsed?.id && stanza.attrs.id === that.lastUsed.id) {
that.lastUsed.status({fill:"red", shape:"ring", text:stanza.getChild('error')}); that.lastUsed.status({fill:"red", shape:"ring", text:stanza.getChild('error')});
that.lastUsed.warn(stanza.getChild('error')); that.lastUsed.warn(stanza.getChild('error'));
} }
@ -529,7 +529,7 @@ module.exports = function(RED) {
statusText = status.getText() || "online"; statusText = status.getText() || "online";
} }
if (statusText !== "" && (stanza.attrs.from !== stanza.attrs.to)) { if (statusText !== "" && stanza.attrs.from && (stanza.attrs.from !== stanza.attrs.to)) {
var from = stanza.attrs.from; var from = stanza.attrs.from;
var msg = { var msg = {
topic:from, topic:from,

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-node-xmpp", "name": "node-red-node-xmpp",
"version": "0.6.1", "version": "0.6.2",
"description": "A Node-RED node to talk to an XMPP server", "description": "A Node-RED node to talk to an XMPP server",
"dependencies": { "dependencies": {
"@xmpp/client": "^0.13.1" "@xmpp/client": "^0.13.1"