From 88e7ac609d302c2674b15ae2fa6ec1d6412b1517 Mon Sep 17 00:00:00 2001 From: Luiz Felipe Stangarlin Date: Thu, 25 Apr 2024 16:25:26 -0500 Subject: [PATCH] fix: _checkStreamError --- src/websocket.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/websocket.js b/src/websocket.js index b83acbe8..43280a08 100644 --- a/src/websocket.js +++ b/src/websocket.js @@ -96,9 +96,13 @@ class Websocket { const ns = 'urn:ietf:params:xml:ns:xmpp-streams'; for (let i = 0; i < error.childNodes.length; i++) { - const e = error.children[i]; - if (e.getAttribute('xmlns') !== ns) { - break; + const e = error.childNodes[i]; + if (e.nodeType === e.ELEMENT_NODE) { + /** @type {Element} */ + const el = /** @type {any} */ (e); + if (el.getAttribute('xmlns') !== ns) { + break; + } } if (e.nodeName === 'text') { text = e.textContent;