File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
app/src/main/kotlin/io/treehouses/remote/bases Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -110,9 +110,14 @@ open class FragmentViewModel(application: Application) : AndroidViewModel(applic
110
110
* Load the bluetooth service and update the handler and connection status
111
111
*/
112
112
fun loadBT () {
113
- mChatService = getApplication<MainApplication >().getCurrentBluetoothService()!!
114
- mChatService.updateHandler(mHandler)
115
- _connectionStatus .value = mChatService.state
113
+ val bluetoothService = getApplication<MainApplication >().getCurrentBluetoothService()
114
+ if (bluetoothService != null ) {
115
+ mChatService = bluetoothService
116
+ mChatService.updateHandler(mHandler)
117
+ _connectionStatus .value = mChatService.state
118
+ } else {
119
+ _connectionStatus .value = Constants .STATE_NONE
120
+ }
116
121
}
117
122
118
123
/* *
You can’t perform that action at this time.
0 commit comments