Merge "Fix crash when comparing messages" am: 42a3c415d7

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2234087

Change-Id: I4a1c12260f76ae843cbc9c8519bf8ab1c41bc992
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Julia Reynolds
2023-01-18 15:39:57 +00:00
committed by Automerger Merge Worker

View File

@@ -68,6 +68,10 @@ public interface MessagingMessage extends MessagingLinearLayout.MessagingChild {
default boolean sameAs(Notification.MessagingStyle.Message message) { default boolean sameAs(Notification.MessagingStyle.Message message) {
Notification.MessagingStyle.Message ownMessage = getMessage(); Notification.MessagingStyle.Message ownMessage = getMessage();
// We have to make sure both messages are not null to go further comparison
if (message == null || ownMessage == null) {
return message == ownMessage;
}
if (!Objects.equals(message.getText(), ownMessage.getText())) { if (!Objects.equals(message.getText(), ownMessage.getText())) {
return false; return false;
} }