From 6e6f73f2c0b0499efd633c5d7edd69c898740d6a Mon Sep 17 00:00:00 2001 From: Grishka Date: Tue, 12 Apr 2022 03:54:51 +0300 Subject: [PATCH] More crash fixes --- mastodon/build.gradle | 2 +- mastodon/proguard-rules.pro | 4 +++- .../android/fragments/HomeTimelineFragment.java | 2 ++ .../android/fragments/NotificationsListFragment.java | 2 ++ .../fragments/discover/DiscoverAccountsFragment.java | 9 +++++++++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mastodon/build.gradle b/mastodon/build.gradle index aa509585..43a5dc00 100644 --- a/mastodon/build.gradle +++ b/mastodon/build.gradle @@ -10,7 +10,7 @@ android { applicationId "org.joinmastodon.android" minSdk 23 targetSdk 31 - versionCode 23 + versionCode 24 versionName "0.1" } diff --git a/mastodon/proguard-rules.pro b/mastodon/proguard-rules.pro index d076fa64..469f1788 100644 --- a/mastodon/proguard-rules.pro +++ b/mastodon/proguard-rules.pro @@ -44,4 +44,6 @@ *; } --keep class org.joinmastodon.android.AppCenterWrapper { *; } \ No newline at end of file +-keep class org.joinmastodon.android.AppCenterWrapper { *; } + +-keepattributes LineNumberTable \ No newline at end of file diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTimelineFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTimelineFragment.java index 976221e1..ddc8a85f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTimelineFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTimelineFragment.java @@ -48,6 +48,8 @@ public class HomeTimelineFragment extends StatusListFragment{ .getHomeTimeline(offset>0 ? getMaxID() : null, count, refreshing, new SimpleCallback<>(this){ @Override public void onSuccess(List result){ + if(getActivity()==null) + return; onDataLoaded(result, !result.isEmpty()); } }); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java index 8894d768..e141c348 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java @@ -103,6 +103,8 @@ public class NotificationsListFragment extends BaseStatusListFragment0 ? getMaxID() : null, count, onlyMentions, refreshing, new SimpleCallback<>(this){ @Override public void onSuccess(List result){ + if(getActivity()==null) + return; if(refreshing) relationships.clear(); onDataLoaded(result.stream().filter(n->n.type!=null).collect(Collectors.toList()), !result.isEmpty()); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverAccountsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverAccountsFragment.java index 9eff4f0a..7b77b518 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverAccountsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverAccountsFragment.java @@ -121,6 +121,15 @@ public class DiscoverAccountsFragment extends BaseRecyclerFragment