kopia lustrzana https://github.com/ge0rg/aprsdroid
Bluetooth: fix NPE when BT not supported
rodzic
b96119595f
commit
fa3bac5c8c
|
|
@ -16,7 +16,12 @@
|
||||||
protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder builder) {
|
protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder builder) {
|
||||||
// hook into the builder to refresh the list
|
// hook into the builder to refresh the list
|
||||||
BluetoothAdapter bta = BluetoothAdapter.getDefaultAdapter();
|
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[] entries = new CharSequence[pairedDevices.size()];
|
||||||
CharSequence[] entryValues = new CharSequence[pairedDevices.size()];
|
CharSequence[] entryValues = new CharSequence[pairedDevices.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue