aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-10-26 19:37:55 +0200
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-10-26 19:37:55 +0200
commitbbc79c5ee177e555f5709c810ef23ba76da60c1d (patch)
tree1476a231ea652d84631008d78d3ec8701a9eff02 /src/main/java/de
parente336d968904a867169f00b50948dfbc84436bd80 (diff)
catch dead system exception when creating error notification
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index 07da9ad54..9ad7850a1 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -576,14 +576,16 @@ public class NotificationService {
if (addedActionsCount < 3) {
final Message firstLocationMessage = getFirstLocationMessage(messages);
if (firstLocationMessage != null) {
- String label = mXmppConnectionService.getResources().getString(R.string.show_location);
- PendingIntent pendingShowLocationIntent = createShowLocationIntent(firstLocationMessage);
- NotificationCompat.Action locationAction = new NotificationCompat.Action.Builder(
- R.drawable.ic_room_white_24dp,
- label,
- pendingShowLocationIntent).build();
- mBuilder.addAction(locationAction);
- ++addedActionsCount;
+ final PendingIntent pendingShowLocationIntent = createShowLocationIntent(firstLocationMessage);
+ if (pendingShowLocationIntent != null) {
+ final String label = mXmppConnectionService.getResources().getString(R.string.show_location);
+ NotificationCompat.Action locationAction = new NotificationCompat.Action.Builder(
+ R.drawable.ic_room_white_24dp,
+ label,
+ pendingShowLocationIntent).build();
+ mBuilder.addAction(locationAction);
+ ++addedActionsCount;
+ }
}
}
if (addedActionsCount < 3) {
@@ -779,7 +781,7 @@ public class NotificationService {
return PendingIntent.getActivity(mXmppConnectionService, generateRequestCode(message.getConversation(), 18), intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
}
- return createOpenConversationsIntent();
+ return null;
}
private PendingIntent createContentIntent(final String conversationUuid, final String downloadMessageUuid) {
@@ -948,6 +950,10 @@ public class NotificationService {
}
mBuilder.setContentText(mXmppConnectionService.getString(R.string.connected_accounts, connected, enabled));
mBuilder.setContentIntent(createOpenConversationsIntent());
+ final PendingIntent openIntent = createOpenConversationsIntent();
+ if (openIntent != null) {
+ mBuilder.setContentIntent(openIntent);
+ }
mBuilder.setWhen(0);
mBuilder.setPriority(Notification.PRIORITY_MIN);
mBuilder.setSmallIcon(connected > 0 ? R.drawable.ic_link_white_24dp : R.drawable.ic_link_off_white_24dp);