Skip to content

Commit

Permalink
Avoid Null reference exceptions in service discovery callbacks
Browse files Browse the repository at this point in the history
Calling disconnect during service discovery often triggers null ref exceptions, sometimes crashing the app.
  • Loading branch information
peitschie committed Jul 19, 2022
1 parent f4c490d commit 4a48120
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/android/Peripheral.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
if (refreshCallback != null) {
refreshCallback.sendPluginResult(result);
refreshCallback = null;
} else {
}

if (connectCallback != null) {
connectCallback.sendPluginResult(result);
}
} else {
Expand Down

0 comments on commit 4a48120

Please sign in to comment.