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

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

Change-Id: Ie67dbfaff1adf7ecae1392d41789aa7060e91c81
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Julia Reynolds
2023-01-18 16:11:51 +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) {
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())) {
return false;
}