From 6bc7f2a5a4eaf175d469c6e1287d6efb24ca4e5c Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Wed, 6 Jun 2018 08:08:52 -0700 Subject: [PATCH] Fix NPE in FTS when snippet is null. --- .../thoughtcrime/securesms/ConversationListItem.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ConversationListItem.java b/src/org/thoughtcrime/securesms/ConversationListItem.java index 231de9c8ff..49eb1a6609 100644 --- a/src/org/thoughtcrime/securesms/ConversationListItem.java +++ b/src/org/thoughtcrime/securesms/ConversationListItem.java @@ -315,13 +315,17 @@ public class ConversationListItem extends RelativeLayout unreadIndicator.setVisibility(View.VISIBLE); } - private Spanned getHighlightedSpan(@NonNull Locale locale, + private Spanned getHighlightedSpan(@NonNull Locale locale, @Nullable String value, @Nullable String highlight) { - value = value != null ? value.replaceAll("\n", " ") : null; + if (value == null) { + return new SpannableString(""); + } - if (value == null || highlight == null) { + value = value.replaceAll("\n", " "); + + if (highlight == null) { return new SpannableString(value); }