Merge "Fix potential NPE when MessagingMessage's message is null"
This commit is contained in:
@@ -927,7 +927,8 @@ public class ConversationLayout extends FrameLayout
|
|||||||
message = messages.get(i - histSize);
|
message = messages.get(i - histSize);
|
||||||
}
|
}
|
||||||
boolean isNewGroup = currentGroup == null;
|
boolean isNewGroup = currentGroup == null;
|
||||||
Person sender = message.getMessage().getSenderPerson();
|
Person sender =
|
||||||
|
message.getMessage() == null ? null : message.getMessage().getSenderPerson();
|
||||||
CharSequence key = getKey(sender);
|
CharSequence key = getKey(sender);
|
||||||
isNewGroup |= !TextUtils.equals(key, currentSenderKey);
|
isNewGroup |= !TextUtils.equals(key, currentSenderKey);
|
||||||
if (isNewGroup) {
|
if (isNewGroup) {
|
||||||
@@ -1190,7 +1191,8 @@ public class ConversationLayout extends FrameLayout
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final MessagingMessage messagingMessage = mMessages.get(mMessages.size() - 1);
|
final MessagingMessage messagingMessage = mMessages.get(mMessages.size() - 1);
|
||||||
final CharSequence text = messagingMessage.getMessage().getText();
|
final CharSequence text = messagingMessage.getMessage() == null ? null
|
||||||
|
: messagingMessage.getMessage().getText();
|
||||||
if (text == null && messagingMessage instanceof MessagingImageMessage) {
|
if (text == null && messagingMessage instanceof MessagingImageMessage) {
|
||||||
final String unformatted =
|
final String unformatted =
|
||||||
getResources().getString(R.string.conversation_single_line_image_placeholder);
|
getResources().getString(R.string.conversation_single_line_image_placeholder);
|
||||||
|
|||||||
@@ -492,7 +492,9 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
|
|||||||
int color = mSendingSpinnerContainer.getVisibility() == View.VISIBLE
|
int color = mSendingSpinnerContainer.getVisibility() == View.VISIBLE
|
||||||
? mSendingTextColor : mTextColor;
|
? mSendingTextColor : mTextColor;
|
||||||
for (MessagingMessage message : mMessages) {
|
for (MessagingMessage message : mMessages) {
|
||||||
message.setColor(message.getMessage().isRemoteInputHistory() ? color : mTextColor);
|
final boolean isRemoteInputHistory =
|
||||||
|
message.getMessage() != null && message.getMessage().isRemoteInputHistory();
|
||||||
|
message.setColor(isRemoteInputHistory ? color : mTextColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -470,7 +470,8 @@ public class MessagingLayout extends FrameLayout
|
|||||||
message = messages.get(i - histSize);
|
message = messages.get(i - histSize);
|
||||||
}
|
}
|
||||||
boolean isNewGroup = currentGroup == null;
|
boolean isNewGroup = currentGroup == null;
|
||||||
Person sender = message.getMessage().getSenderPerson();
|
Person sender =
|
||||||
|
message.getMessage() == null ? null : message.getMessage().getSenderPerson();
|
||||||
CharSequence key = sender == null ? null
|
CharSequence key = sender == null ? null
|
||||||
: sender.getKey() == null ? sender.getName() : sender.getKey();
|
: sender.getKey() == null ? sender.getName() : sender.getKey();
|
||||||
isNewGroup |= !TextUtils.equals(key, currentSenderKey);
|
isNewGroup |= !TextUtils.equals(key, currentSenderKey);
|
||||||
|
|||||||
Reference in New Issue
Block a user