Fixes #459 - Crashes with regex

This commit is contained in:
stom79 2018-05-13 15:31:40 +02:00
parent 61e73dfc0b
commit 003d583e00
1 changed files with 14 additions and 10 deletions

View File

@ -391,16 +391,20 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
filter = sharedpreferences.getString(Helper.SET_FILTER_REGEX_PUBLIC, null);
if( filter != null && filter.length() > 0){
Pattern filterPattern = Pattern.compile("(" + filter + ")", Pattern.CASE_INSENSITIVE);
String content;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
else
//noinspection deprecation
content = Html.fromHtml(status.getContent()).toString();
Matcher matcher = filterPattern.matcher(content);
if(matcher.find())
return HIDDEN_STATUS;
try {
Pattern filterPattern = Pattern.compile("(" + filter + ")", Pattern.CASE_INSENSITIVE);
String content;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
else
//noinspection deprecation
content = Html.fromHtml(status.getContent()).toString();
Matcher matcher = filterPattern.matcher(content);
if (matcher.find())
return HIDDEN_STATUS;
}catch (Exception e){
return DISPLAYED_STATUS;
}
}
if( type == RetrieveFeedsAsyncTask.Type.HOME) {
if (status.getReblog() != null && !sharedpreferences.getBoolean(Helper.SET_SHOW_BOOSTS, true))