mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix autobug: if app is shutting down, the activtity might be killed
while the BLE scan is still happening
This commit is contained in:
parent
c0ada64653
commit
e05a445a34
1 changed files with 4 additions and 2 deletions
|
|
@ -169,9 +169,11 @@ class BTScanModel(app: Application) : AndroidViewModel(app), Logging {
|
|||
debug("onScanResult ${entry}")
|
||||
|
||||
// If nothing was selected, by default select the first valid thing we see
|
||||
if (selectedAddress == null && entry.bonded)
|
||||
val activity =
|
||||
GeeksvilleApplication.currentActivity as MainActivity? // Can be null if app is shutting down
|
||||
if (selectedAddress == null && entry.bonded && activity != null)
|
||||
changeScanSelection(
|
||||
GeeksvilleApplication.currentActivity as MainActivity,
|
||||
activity,
|
||||
fullAddr
|
||||
)
|
||||
addDevice(entry) // Add/replace entry
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue