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
110110 * Load the bluetooth service and update the handler and connection status
111111 */
112112 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+ }
116121 }
117122
118123 /* *
You can’t perform that action at this time.
0 commit comments