Skip to content

Commit

Permalink
bluetooth: smoother checks (fixes #2090) (#2154)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <dogi@users.noreply.github.com>
  • Loading branch information
Okuro3499 and dogi authored Dec 3, 2024
1 parent 27b544c commit 0114f01
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ open class FragmentViewModel(application: Application) : AndroidViewModel(applic
* Load the bluetooth service and update the handler and connection status
*/
fun loadBT() {
mChatService = getApplication<MainApplication>().getCurrentBluetoothService()!!
mChatService.updateHandler(mHandler)
_connectionStatus.value = mChatService.state
val bluetoothService = getApplication<MainApplication>().getCurrentBluetoothService()
if (bluetoothService != null) {
mChatService = bluetoothService
mChatService.updateHandler(mHandler)
_connectionStatus.value = mChatService.state
} else {
_connectionStatus.value = Constants.STATE_NONE
}
}

/**
Expand Down

0 comments on commit 0114f01

Please sign in to comment.