From 4b3bbf8e7e753033f15d8b4bc9dafd05cf1235bc Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 11 Jun 2020 11:29:07 +0800 Subject: Fix force stop when long pressing the toolbar in MainActivity in anonymous mode. --- .../infinityforreddit/Activity/MainActivity.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index 14c12d2e..ad7458f7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -1366,9 +1366,17 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb void goBackToTop() { if (viewPager.getCurrentItem() == 0) { - tab1.goBackToTop(); + if (mAccessToken != null && tab1 != null) { + tab1.goBackToTop(); + } else if (tab2 != null) { + tab2.goBackToTop(); + } } else if (viewPager.getCurrentItem() == 1) { - tab2.goBackToTop(); + if (mAccessToken != null && tab2 != null) { + tab2.goBackToTop(); + } else if (tab3 != null) { + tab3.goBackToTop(); + } } else { tab3.goBackToTop(); } -- cgit v1.2.3