Don't crash if device doesn't have Bluetooth

This commit is contained in:
Felix Ableitner 2016-09-30 16:50:27 +09:00
parent 2ed57f6dec
commit 8334cd3926
1 changed files with 2 additions and 1 deletions

View File

@ -39,7 +39,8 @@ class FirstStartActivity extends AppCompatActivity with OnEditorActionListener w
setContentView(R.layout.activity_first_start)
setTitle(R.string.welcome)
username.setText(BluetoothAdapter.getDefaultAdapter.getName.trim)
val name = Option(BluetoothAdapter.getDefaultAdapter).map(_.getName.trim).getOrElse("")
username.setText(name)
username.setOnEditorActionListener(this)
done.setOnClickListener(this)