From: Matthew Xie Date: Mon, 4 Aug 2014 17:40:24 +0000 (-0700) Subject: Check null mHandler condition before invoking method on it X-Git-Tag: android-7.1.2_r17~424^2~129 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=62fb56f2ba7d998e3e7416fc19d25ea91cc85111;p=android-x86%2Fpackages-apps-Bluetooth.git Check null mHandler condition before invoking method on it 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 --- diff --git a/src/com/android/bluetooth/hdp/HealthService.java b/src/com/android/bluetooth/hdp/HealthService.java index cef06e81..21846c67 100644 --- a/src/com/android/bluetooth/hdp/HealthService.java +++ b/src/com/android/bluetooth/hdp/HealthService.java @@ -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;