From 2818672cdad3685ef549b906e16dfc3291bdf7ba Mon Sep 17 00:00:00 2001 From: S1m <31284753+p1gp1g@users.noreply.github.com> Date: Fri, 10 Nov 2023 20:15:45 +0100 Subject: [PATCH] Fix NullPointerException when receiving push when killed (#914) --- .../org/joinmastodon/android/api/session/AccountSession.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSession.java b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSession.java index 3f9f1fe26b..5d70e0b236 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSession.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSession.java @@ -260,11 +260,13 @@ private boolean statusIsOnOwnProfile(Status s, Account profile){ } private boolean isFilteredType(Status s){ + AccountLocalPreferences localPreferences = getLocalPreferences(); return (!localPreferences.showReplies && s.inReplyToId != null) || (!localPreferences.showBoosts && s.reblog != null); } public void filterStatusContainingObjects(List objects, Function extractor, FilterContext context, Account profile){ + AccountLocalPreferences localPreferences = getLocalPreferences(); if(!localPreferences.serverSideFiltersSupported) for(T obj:objects){ Status s=extractor.apply(obj); if(s!=null && s.filtered!=null){ @@ -307,7 +309,7 @@ public boolean filterStatusContainingObject(T object, Function ex if(isFilteredType(s) && (context == FilterContext.HOME || context == FilterContext.PUBLIC)) return true; // Even with server-side filters, clients are expected to remove statuses that match a filter that hides them - if(localPreferences.serverSideFiltersSupported){ + if(getLocalPreferences().serverSideFiltersSupported){ for(FilterResult filter : s.filtered){ if(filter.filter.isActive() && filter.filter.filterAction==FilterAction.HIDE) return true;