Skip to content

Commit

Permalink
More null handling?
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeraj Baid committed Feb 13, 2023
1 parent 420c1ce commit d7981e8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/accessory-light.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module.exports = async (hap, accessory, el, address, eoj) => {
const propertyValue = (await el.getPropertyValue(address, eoj, 0x80))
console.log("Log1")
console.log(propertyValue.message.data)
if (propertyValue.message.data == null) {
return
}
let {status} = propertyValue.message.data
service.updateCharacteristic(hap.Characteristic.On, status)

Expand All @@ -23,7 +26,7 @@ module.exports = async (hap, accessory, el, address, eoj) => {
el.getPropertyValue(address, eoj, 0x80).then((res) => {
// console.log("Log2")
// console.log(res.message.data)
if (res.message.data != null) {
if (res != null && res.message.data != null) {
updateStatus(res.message.data.status)
}
})
Expand Down

0 comments on commit d7981e8

Please sign in to comment.