Commit fbee7259 authored by testquepp's avatar testquepp Committed by GitHub

Update RNDeviceModule.java

There might be some scenario where the developers who are using this library might not be using Bluetooth permission. so this mDevice object will be null in this case and it should be handled properly. As some will not want to add this unnecessary permission in their project.
parent c843144e
...@@ -92,7 +92,9 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { ...@@ -92,7 +92,9 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
try { try {
BluetoothAdapter myDevice = BluetoothAdapter.getDefaultAdapter(); BluetoothAdapter myDevice = BluetoothAdapter.getDefaultAdapter();
deviceName = myDevice.getName(); if(mDevice!=null){
deviceName = myDevice.getName();
}
} catch(Exception e) { } catch(Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment