mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
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:
parent
0cfe6eebcc
commit
f23c780eee
1 changed files with 12 additions and 10 deletions
|
@ -173,9 +173,10 @@ func (mod *BLERecon) Start() error {
|
||||||
|
|
||||||
<-mod.quit
|
<-mod.quit
|
||||||
|
|
||||||
|
if mod.gattDevice != nil {
|
||||||
mod.Info("stopping scan ...")
|
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.Debug("resetting connection with %v", mod.currDevice.Device)
|
||||||
mod.gattDevice.CancelConnection(mod.currDevice.Device)
|
mod.gattDevice.CancelConnection(mod.currDevice.Device)
|
||||||
}
|
}
|
||||||
|
@ -186,6 +187,7 @@ func (mod *BLERecon) Start() error {
|
||||||
} else {
|
} else {
|
||||||
mod.Debug("gatt device closed")
|
mod.Debug("gatt device closed")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mod.done <- true
|
mod.done <- true
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue