diff --git a/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java b/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java index fe1101e37..c888391b5 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java +++ b/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java @@ -61,7 +61,7 @@ public class CustomPushNotification extends PushNotification { } notificationMessages.get(notId).add(message); - super.postNotification(Integer.parseInt(notId)); + super.postNotification(notId != null ? Integer.parseInt(notId) : 1); notifyReceivedToJS(); } @@ -91,7 +91,7 @@ public class CustomPushNotification extends PushNotification { .setDefaults(Notification.DEFAULT_ALL) .setAutoCancel(true); - Integer notificationId = Integer.parseInt(notId); + Integer notificationId = notId != null ? Integer.parseInt(notId) : 1; notificationChannel(notification); notificationIcons(notification, bundle); notificationStyle(notification, notificationId, bundle); diff --git a/android/app/src/main/java/chat/rocket/reactnative/Ejson.java b/android/app/src/main/java/chat/rocket/reactnative/Ejson.java index 6ef2dfb3d..591fda93a 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/Ejson.java +++ b/android/app/src/main/java/chat/rocket/reactnative/Ejson.java @@ -14,7 +14,7 @@ public class Ejson { private SharedPreferences sharedPreferences = RNUserDefaultsModule.getPreferences(CustomPushNotification.reactApplicationContext); public String getAvatarUri() { - if (!type.equals("d")) { + if (type == null || !type.equals("d")) { return null; } return serverURL() + "/avatar/" + this.sender.username + "?rc_token=" + token() + "&rc_uid=" + userId();