fix: fixed a bug in ble.recon which sometimes caused a crash if ble.recon off was called but no device was present

This commit is contained in:
evilsocket 2019-03-21 10:57:16 +01:00
commit f23c780eee
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -173,9 +173,10 @@ func (mod *BLERecon) Start() error {
<-mod.quit
if mod.gattDevice != nil {
mod.Info("stopping scan ...")
if mod.currDevice != nil && mod.currDevice.Device != nil && mod.gattDevice != nil {
if mod.currDevice != nil && mod.currDevice.Device != nil {
mod.Debug("resetting connection with %v", mod.currDevice.Device)
mod.gattDevice.CancelConnection(mod.currDevice.Device)
}
@ -186,6 +187,7 @@ func (mod *BLERecon) Start() error {
} else {
mod.Debug("gatt device closed")
}
}
mod.done <- true
})