Skip to content

Commit e318673

Browse files
authored
Merge pull request #245 from marqroldan/patch-1
AppRTCBluetoothManager | Redundantly handle null case when unregistering
2 parents a07febe + 16c562a commit e318673

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

android/src/main/java/com/zxcpoiu/incallmanager/AppRTC/AppRTCBluetoothManager.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,15 @@ protected void registerReceiver(BroadcastReceiver receiver, IntentFilter filter)
483483
}
484484
}
485485
protected void unregisterReceiver(BroadcastReceiver receiver) {
486-
apprtcContext.unregisterReceiver(receiver);
486+
if (receiver != null) {
487+
try {
488+
apprtcContext.unregisterReceiver(receiver);
489+
} catch (final Exception exception) {
490+
// The receiver was not registered.
491+
// There is nothing to do in that case.
492+
// Everything is fine.
493+
}
494+
}
487495
}
488496
protected boolean getBluetoothProfileProxy(
489497
Context context, BluetoothProfile.ServiceListener listener, int profile) {

0 commit comments

Comments
 (0)