diff options
author | Arnav Gupta <championswimmer@gmail.com> | 2016-02-10 05:57:49 +0530 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-04-13 09:28:37 -0700 |
commit | f64343e182386b9d8df5f60390022a9603ded598 (patch) | |
tree | b488ae198453095fedd2f8c47106c6f0b2e7f2af | |
parent | efb1d740dfd19117629fe419bdde623840f7f6b7 (diff) | |
download | android_packages_apps_Bluetooth-f64343e182386b9d8df5f60390022a9603ded598.tar.gz android_packages_apps_Bluetooth-f64343e182386b9d8df5f60390022a9603ded598.tar.bz2 android_packages_apps_Bluetooth-f64343e182386b9d8df5f60390022a9603ded598.zip |
hdp: do not return a null value when hdp interface unavailable
We're not supposed to return a NULL from a int return function.
And indeed the calling Java code does not have a NPE check either.
If an HDP interface is not avaialable, send -1 which the Java
code correctly assumes as a failure to register the health app.
Change-Id: I5ac7dc6f9acc9fefae8d1d2233453448c3ba79bc
Signed-off-by: Arnav Gupta <championswimmer@gmail.com>
-rw-r--r-- | jni/com_android_bluetooth_hdp.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/jni/com_android_bluetooth_hdp.cpp b/jni/com_android_bluetooth_hdp.cpp index 81c8312c1..8556e6a89 100644 --- a/jni/com_android_bluetooth_hdp.cpp +++ b/jni/com_android_bluetooth_hdp.cpp @@ -195,7 +195,10 @@ static jint registerHealthAppNative(JNIEnv *env, jobject object, jint data_type, bthl_reg_param_t reg_param; int app_id; - if (!sBluetoothHdpInterface) return NULL; + if (!sBluetoothHdpInterface) { + ALOGE("Failed register health app. No Bluetooth Health Interface available"); + return -1; + } mdep_cfg.mdep_role = (bthl_mdep_role_t) role; mdep_cfg.data_type = data_type; |