Merge "Error handler for start dialog from adb command"
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index 060c174..927b1b6 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -65,6 +65,11 @@
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
+ if (intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) == null) {
+ // Error handler for the case that dialog is started from adb command.
+ finish();
+ return;
+ }
mBluetoothPairingController = new BluetoothPairingController(intent, this);
// build the dialog fragment
boolean fragmentFound = true;