diff --git a/alexa-wsmqtt.js b/alexa-wsmqtt.js index d8033829..062a1763 100755 --- a/alexa-wsmqtt.js +++ b/alexa-wsmqtt.js @@ -120,7 +120,7 @@ class AlexaWsMqtt extends EventEmitter { this.websocket.on('error', (error) => { this._options.logger && this._options.logger('Alexa-Remote WS-MQTT: Error: ' + error); this.emit('error', error); - this.websocket.terminate(); + this.websocket && this.websocket.terminate(); }); this.websocket.on('unexpected-response', (request, response) => { @@ -170,7 +170,7 @@ class AlexaWsMqtt extends EventEmitter { this.pongTimeout = setTimeout(() => { this.pongTimeout = null; this._options.logger && this._options.logger('Alexa-Remote WS-MQTT: No Pong received after 30s'); - this.websocket.close(); + this.websocket && this.websocket.close(); }, 30000); }, 180000); } diff --git a/package.json b/package.json index b955dee9..0b882650 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "alexa-remote2", - "version": "3.0.1", + "version": "3.0.2", "description": "Remote Control for amazon echo devices", "author": { "name": "Apollon77", diff --git a/readme.md b/readme.md index 4c06741a..125a3568 100644 --- a/readme.md +++ b/readme.md @@ -27,6 +27,9 @@ Thank you for that work. ## Changelog: +### 3.0.2 (2019-12-26) +* (Apollon77) Prevent some errors + ### 3.0.1 (2019-12-24) * (Apollon77) Prevent some errors, dependency update