Fix crash when comparing messages
This crash has no permanent repro steps, it happened during monkey tests. In sameAs(), we have to make sure both messages are not null to go further field comparison, or a crash may happen. Bug: 249235154 Test: manual Change-Id: I05499a5d5ba80d144db85dd6a299631eab905fe4
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user