aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 18094cfb..ddc40d34 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -662,7 +662,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
@Override
public void onDestroy() {
- unregisterReceiver(this.mEventReceiver);
+ try {
+ unregisterReceiver(this.mEventReceiver);
+ } catch (IllegalArgumentException e) {
+ //ignored
+ }
super.onDestroy();
}
@@ -672,12 +676,16 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
filter.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(this.mEventReceiver, filter);
} else {
- unregisterReceiver(this.mEventReceiver);
+ try {
+ unregisterReceiver(this.mEventReceiver);
+ } catch (IllegalArgumentException e) {
+ //ignored
+ }
}
}
public void toggleForegroundService() {
- if (getPreferences().getBoolean("keep_foreground_service",false)) {
+ if (getPreferences().getBoolean("keep_foreground_service", false)) {
startForeground(NotificationService.FOREGROUND_NOTIFICATION_ID, this.mNotificationService.createForegroundNotification());
} else {
stopForeground(true);