Fix error when disconnecting from non-open socket

This commit is contained in:
Jan-Philipp Ottmüller 2017-04-14 23:22:15 +02:00
commit f976c757ee
2 changed files with 4 additions and 2 deletions

View file

@ -3,7 +3,7 @@
"description": "Create rcon connections using websockets", "description": "Create rcon connections using websockets",
"author": "Robin Appelman <robin@icewind.nl>", "author": "Robin Appelman <robin@icewind.nl>",
"license": "MIT", "license": "MIT",
"version": "0.2.2", "version": "0.2.3",
"main": "lib/rcon.js", "main": "lib/rcon.js",
"scripts": { "scripts": {
"build": "babel src --out-dir lib" "build": "babel src --out-dir lib"

View file

@ -64,6 +64,8 @@ export default class WebRcon extends EventEmitter {
} }
disconnect () { disconnect () {
if (this.socket && this.socket.disconnect) {
this.socket.disconnect(); this.socket.disconnect();
} }
}
} }