diff options
author | Petre Eftime <[email protected]> | 2016-02-19 18:28:13 +0200 |
---|---|---|
committer | Petre Eftime <[email protected]> | 2016-02-29 15:12:56 +0200 |
commit | e8360168b7b32f1bd76e3451695b7fa8e521b601 (patch) | |
tree | a05cb03c6493fb52ff0702fbdbeed9dfb6dda5e3 /java/jni/BluetoothManager.cxx | |
parent | c2a222041f5edfdee950ccd848d7da138790d2fa (diff) |
Better handling of default adapter and initialization
Signed-off-by: Petre Eftime <[email protected]>
Diffstat (limited to 'java/jni/BluetoothManager.cxx')
-rw-r--r-- | java/jni/BluetoothManager.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/java/jni/BluetoothManager.cxx b/java/jni/BluetoothManager.cxx index 917961c..ecc56c7 100644 --- a/java/jni/BluetoothManager.cxx +++ b/java/jni/BluetoothManager.cxx @@ -160,14 +160,13 @@ jobject Java_tinyb_BluetoothManager_getServices(JNIEnv *env, jobject obj) jboolean Java_tinyb_BluetoothManager_setDefaultAdapter(JNIEnv *env, jobject obj, jobject adapter) { - if (!adapter) - { + if (adapter == nullptr) throw std::invalid_argument("adapter argument is null\n"); - } + BluetoothManager *manager = getInstance<BluetoothManager>(env, obj); BluetoothAdapter *b_adapter = getInstance<BluetoothAdapter>(env, adapter); - return manager->set_default_adapter(b_adapter); + return manager->set_default_adapter(*b_adapter); } jboolean Java_tinyb_BluetoothManager_startDiscovery(JNIEnv *env, jobject obj) |