OSDN Git Service

Check null mHandler condition before invoking method on it
authorMatthew Xie <mattx@google.com>
Mon, 4 Aug 2014 17:40:24 +0000 (10:40 -0700)
committerMatthew Xie <mattx@google.com>
Mon, 4 Aug 2014 17:49:41 +0000 (10:49 -0700)
There is a path that clean up is called before stop call on HealthService
mHandler could be set to null
bug 16784750

Change-Id: Ie931fa502cf82d21c6bf97a8dc7035e5a1ed4b2e

src/com/android/bluetooth/hdp/HealthService.java

index cef06e8..21846c6 100644 (file)
@@ -100,10 +100,12 @@ public class HealthService extends ProfileService {
     }
 
     protected boolean stop() {
-        mHandler.removeCallbacksAndMessages(null);
-        Looper looper = mHandler.getLooper();
-        if (looper != null) {
-            looper.quit();
+        if (mHandler != null) {
+            mHandler.removeCallbacksAndMessages(null);
+            Looper looper = mHandler.getLooper();
+            if (looper != null) {
+                looper.quit();
+            }
         }
         cleanupApps();
         return true;