Avoid NPE when subject/snippet are null.

There are cases when subject and snippet re null. If the MessageListItem
is not being recycled (i.e. it's the first time), this can be detected
as "no change from the previous state (of being empty)", which doesn't
initialize mText.

Bug: 5129307
Change-Id: I6df910fb365b7e8c1dd298f787d21fbb438830fd
This commit is contained in:
Ben Komalo 2011-08-07 16:04:16 -07:00
parent 03cb4a2135
commit dce6aafe4e

View File

@ -190,11 +190,11 @@ public class MessageListItem extends View {
if (!Objects.equal(mSnippet, snippet)) {
mSnippet = snippet;
mSnippetLineCount = MessageListItem.NEEDS_LAYOUT;
mSnippetLineCount = NEEDS_LAYOUT;
changed = true;
}
if (changed) {
if (changed || (mSubject == null && mSnippet == null) /* first time */) {
SpannableStringBuilder ssb = new SpannableStringBuilder();
boolean hasSubject = false;
if (!TextUtils.isEmpty(mSubject)) {