From c809ff0e61c48d1e3bd805a70d7a56eed5bc0276 Mon Sep 17 00:00:00 2001 From: John A Knight Jr Date: Mon, 20 Mar 2023 14:56:35 -0700 Subject: [PATCH] Bugfix: Check and report for empty host --- index.js | 18 ++++++++++++------ package.json | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 5567db9..5a6a7b9 100644 --- a/index.js +++ b/index.js @@ -89,8 +89,11 @@ class BAirInstance extends InstanceBase { // a bit more processing than available in // an upgrade script :) if ('' == config.host) { - config.host = this.unitsFound[config.mixer].m_ip - this.saveConfig(config) + let u = this.unitsFound[config.mixer] + if (u) { + config.host = u + this.saveConfig(config) + } } // do we have a name for this host? if (config.scan) { @@ -488,7 +491,10 @@ class BAirInstance extends InstanceBase { if (this.oscPort) { this.oscPort.close() } - if (this.config.host) { + if (!this.config.host) { + this.updateStatus(InstanceStatus.ConnectionFailure,'No host IP') + } else { +// if (this.config.host) { this.oscPort = new OSC.UDPPort({ localAddress: '0.0.0.0', localPort: 0, @@ -588,11 +594,11 @@ class BAirInstance extends InstanceBase { 's_name': n, ['s_name_' + pad0(s)]: n, }) - self.prevSnapshot = 1>=s ? 0 : s - 1 - self.nextSnapshot = 64<=s ? 0 : s + 1 + self.prevSnapshot = 1 >= s ? 0 : s - 1 + self.nextSnapshot = 64 <= s ? 0 : s + 1 self.setVariableValues({ 's_name_p': self.xStat[self.snapshot[self.prevSnapshot]]?.name ?? '-----', - 's_name_n': self.xStat[self.snapshot[self.nextSnapshot]]?.name ?? '-----', + 's_name_n': self.xStat[self.snapshot[self.nextSnapshot]]?.name ?? '-----', }) self.checkFeedbacks('snap_color') self.sendOSC('/-snap/' + pad0(s) + '/name', []) diff --git a/package.json b/package.json index 0da9cdd..fbbfade 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "behringer-xair", - "version": "2.0.3", + "version": "2.0.4", "type": "module", "main": "index.js", "scripts": {