OSDN Git Service

Fix NPE when performing BLE scans.
authorSharvil Nanavati <sharvil@google.com>
Sat, 26 Mar 2016 00:03:53 +0000 (17:03 -0700)
committerSharvil Nanavati <sharvil@google.com>
Sat, 26 Mar 2016 00:03:53 +0000 (17:03 -0700)
Bug: 27811549
Change-Id: I017b34745682dd9db5487921df5c01dfde93d67c

src/com/android/bluetooth/gatt/ContextMap.java

index 6f9025d..8cc65d9 100644 (file)
@@ -154,11 +154,11 @@ import com.android.bluetooth.btservice.BluetoothProto;
         }
         synchronized (mApps) {
             AppScanStats appScanStats = mAppScanStats.get(appName);
-            mApps.add(new App(uuid, callback, appName, appScanStats));
             if (appScanStats == null) {
                 appScanStats = new AppScanStats(appName, this, service);
                 mAppScanStats.put(appName, appScanStats);
             }
+            mApps.add(new App(uuid, callback, appName, appScanStats));
             appScanStats.isRegistered = true;
         }
     }