diff --git a/lib/airsonos.js b/lib/airsonos.js index 61ca1b3..3299fd3 100644 --- a/lib/airsonos.js +++ b/lib/airsonos.js @@ -50,7 +50,11 @@ class AirSonos { } stop() { - return Promise.all(this.tunnels.map(tunnel.stop)); + var promises = [] + for (let id in this.tunnels) { + promises.push(this.tunnels[id].stop()) + } + return Promise.all(promises); } } diff --git a/lib/tunnel.js b/lib/tunnel.js index a855eff..4bd1dbe 100644 --- a/lib/tunnel.js +++ b/lib/tunnel.js @@ -96,8 +96,8 @@ class DeviceTunnel extends events.EventEmitter { } stop() { - this.airplayServer.stop(); - this.icecastServer.stop(); + if (this.airplayServer) this.airplayServer.stop(); + if (this.icecastServer) this.icecastServer.stop(); } } diff --git a/package.json b/package.json index 0f76c53..2538379 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "flags": "~0.1.2", "ip": "1.1.0", "nicercast": "0.1.0", - "nodetunes": "^0.3.0", + "nodetunes": "git://github.com/jessepollak/nodetunes#master", "sonos": "git://github.com/stephen/node-sonos.git#stephen-1.0.0" }, "license": "MIT",