Skip to content

Commit

Permalink
Merge pull request #84 from helium/bugfix/ble-destroy
Browse files Browse the repository at this point in the history
Fix destroy ble crash
  • Loading branch information
ChewingGlass authored Dec 11, 2023
2 parents 1893a12 + 5d3b688 commit 3df7c09
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/HotspotBle/useHotspotBle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ const useHotspotBle = () => {

return () => {
console.log('destroy ble manager')
manager.destroy()
;(async () => {
const state = await manager.state()
if (state === 'PoweredOn') {
manager.destroy()
}
})()

instanceRef.current = null
}
}, [])
Expand Down

0 comments on commit 3df7c09

Please sign in to comment.