diff options
author | Matthew Xie <mattx@google.com> | 2012-05-01 17:15:10 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-05-01 17:15:10 -0700 |
commit | 02c4b353f7b2427d8a335e41fc336aea7cede8a3 (patch) | |
tree | da56ad65a112d416979efbee0c6d4606fe0d2c0a /core/java/android/server | |
parent | d72ad2ac88ae8477a95e18a800062446a58c524d (diff) | |
download | frameworks_base-02c4b353f7b2427d8a335e41fc336aea7cede8a3.zip frameworks_base-02c4b353f7b2427d8a335e41fc336aea7cede8a3.tar.gz frameworks_base-02c4b353f7b2427d8a335e41fc336aea7cede8a3.tar.bz2 |
Check null of address in onDeviceCreated
address can be null that returned from getAddressFromObjectPath.
If it is null case, donot continue call getRemoteDeviceProperties.
Otherwise it causes null pointer exception and crash the system.
Bug 6338780
Change-Id: Ib190342032ab2ad11c49f44fa6d4b2509a861514
Diffstat (limited to 'core/java/android/server')
-rw-r--r-- | core/java/android/server/BluetoothEventLoop.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index 9c887a1..b758e7f 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -268,6 +268,11 @@ class BluetoothEventLoop { */ private void onDeviceCreated(String deviceObjectPath) { String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); + if (address == null) { + Log.e(TAG, "onDeviceCreated: device address null!" + " deviceObjectPath: " + + deviceObjectPath); + return; + } if (!mBluetoothService.isRemoteDeviceInCache(address)) { // Incoming connection, we haven't seen this device, add to cache. String[] properties = mBluetoothService.getRemoteDeviceProperties(address); @@ -275,7 +280,6 @@ class BluetoothEventLoop { addDevice(address, properties); } } - return; } /** |