Bluetooth: fix NPE when BT not supported

usb
Georg Lukas 2014-12-20 17:28:31 +01:00
rodzic b96119595f
commit fa3bac5c8c
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -16,7 +16,12 @@
protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder builder) {
// hook into the builder to refresh the list
BluetoothAdapter bta = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> pairedDevices = bta.getBondedDevices();
Set<BluetoothDevice> pairedDevices = (bta != null) ? bta.getBondedDevices() : null;
if (pairedDevices == null) {
super.onPrepareDialogBuilder(builder);
return;
}
CharSequence[] entries = new CharSequence[pairedDevices.size()];
CharSequence[] entryValues = new CharSequence[pairedDevices.size()];
int i = 0;