MM-37674 Fix android push notification crash (#5601)

This commit is contained in:
Elias Nahum
2021-08-06 09:00:14 -04:00
committed by GitHub
parent 3ac73e808b
commit fdf93ae0c5

View File

@@ -80,7 +80,10 @@ public class CustomPushNotificationHelper {
.setName(senderName);
try {
sender.setIcon(IconCompat.createWithBitmap(Objects.requireNonNull(userAvatar(context, senderId))));
Bitmap avatar = userAvatar(context, senderId);
if (avatar != null) {
sender.setIcon(IconCompat.createWithBitmap(avatar));
}
} catch (IOException e) {
e.printStackTrace();
}
@@ -242,7 +245,10 @@ public class CustomPushNotificationHelper {
.setName("Me");
try {
sender.setIcon(IconCompat.createWithBitmap(Objects.requireNonNull(userAvatar(context, "me"))));
Bitmap avatar = userAvatar(context, "me");
if (avatar != null) {
sender.setIcon(IconCompat.createWithBitmap(avatar));
}
} catch (IOException e) {
e.printStackTrace();
}
@@ -393,7 +399,10 @@ public class CustomPushNotificationHelper {
if (channelName.equals(senderName)) {
try {
String senderId = bundle.getString("sender_id");
notification.setLargeIcon(userAvatar(context, senderId));
Bitmap avatar = userAvatar(context, senderId);
if (avatar != null) {
notification.setLargeIcon(avatar);
}
} catch (IOException e) {
e.printStackTrace();
}