Fix NPE in MessageListItem

Not sure in what condition Message.displayName can be null, but addign this
check won't harm...

Bug 3339309

Change-Id: Ic2261fc33cf2be759411b998707a96eedd4e4fdb
This commit is contained in:
Makoto Onuki 2011-01-11 17:20:45 -08:00
parent f7b8bc1ed7
commit 0a73e8cd45

View File

@ -328,7 +328,12 @@ public class MessageListItem extends View {
TextPaint senderPaint = mRead ? sDefaultPaint : sBoldPaint;
int senderWidth = (mMode == MODE_WIDE) ? sSenderWidth : mSenderSnippetWidth;
// And get the ellipsized string for the calculated width
mFormattedSender = TextUtils.ellipsize(mSender, senderPaint, senderWidth, TruncateAt.END);
if (TextUtils.isEmpty(mSender)) {
mFormattedSender = "";
} else {
mFormattedSender = TextUtils.ellipsize(mSender, senderPaint, senderWidth,
TruncateAt.END);
}
// Get a nicely formatted date string (relative to today)
String date = DateUtils.getRelativeTimeSpanString(getContext(), mTimestamp).toString();
// And make it fit to our size