Skip to content

Commit

Permalink
fix: first parsing device data
Browse files Browse the repository at this point in the history
  • Loading branch information
Actardnes committed Dec 16, 2020
1 parent 4c9e8f9 commit aaf56ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blebox/abstractBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class AbstractAccessoryWrapper {
}
if (!device.ip) {
const currentDevice = this.getDevice();
device.ip = currentDevice.ip;
device.ip = currentDevice && currentDevice.ip;
}
device.deviceName = device.deviceName ? device.deviceName.replace(NON_ALPHANUMERIC_REGEX, ' ') : "";
return device;
Expand All @@ -110,7 +110,7 @@ class AbstractAccessoryWrapper {
const newDevice = this.parseDeviceInfo(deviceInfo);
if (newDevice) {
const device = this.getDevice();
if(device.id === newDevice.id) {
if (!device || device.id === newDevice.id) {
this.accessory.context.blebox.device = newDevice;
if (device && device.deviceName !== newDevice.deviceName) {
this.updateDeviceInfoCharacteristics();
Expand Down

0 comments on commit aaf56ee

Please sign in to comment.