Skip to content

Commit

Permalink
Bluetooth Helper : fix possible NullPointerException
Browse files Browse the repository at this point in the history
  • Loading branch information
brunotl committed Aug 5, 2024
1 parent 6614471 commit 9a4e125
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions android/src/org/LK8000/BluetoothHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ final class BluetoothHelper {
BluetoothLeScanner _scanner = null;
if (adapter != null) {
try {
_scanner = _adapter.getBluetoothLeScanner();
_scanner = adapter.getBluetoothLeScanner();
} catch (Exception e) {
Log.e(TAG, "BluetoothAdapter.getBluetoothLeScanner() failed", e);
}
Expand All @@ -83,7 +83,9 @@ final class BluetoothHelper {
}

public static void cancelDiscovery() {
adapter.cancelDiscovery();
if (adapter != null) {
adapter.cancelDiscovery();
}
}

public static void Initialize(Context context) {
Expand Down

0 comments on commit 9a4e125

Please sign in to comment.