From dce6aafe4edc5668cdcb2d60d097c84e078adc54 Mon Sep 17 00:00:00 2001 From: Ben Komalo Date: Sun, 7 Aug 2011 16:04:16 -0700 Subject: [PATCH] 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 --- src/com/android/email/activity/MessageListItem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/activity/MessageListItem.java b/src/com/android/email/activity/MessageListItem.java index 64d1ca5bd..369386bd1 100644 --- a/src/com/android/email/activity/MessageListItem.java +++ b/src/com/android/email/activity/MessageListItem.java @@ -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)) {