mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
null check to avoid launch crash
immediately hitting the feed tab after launch will produce the following crash, so this resolves it by a null check: ``` java.lang.NullPointerException: Attempt to read from field 'awais.instagrabber.customviews.PostsRecyclerView awais.instagrabber.databinding.FragmentFeedBinding.feedRecyclerView' on a null object reference at awais.instagrabber.fragments.main.FeedFragment.scrollToTop(FeedFragment.java:461) at awais.instagrabber.utils.NavigationExtensions.lambda$setupItemReselected$2(NavigationExtensions.java:190) at awais.instagrabber.utils.-$$Lambda$NavigationExtensions$C3II1R-NOFB80ERAxio06uf3Qto.onNavigationItemReselected(Unknown Source:4) ... ```
This commit is contained in:
parent
fc70129c96
commit
23b7119846
@ -458,9 +458,11 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void scrollToTop() {
|
public void scrollToTop() {
|
||||||
|
if (binding != null) {
|
||||||
binding.feedRecyclerView.smoothScrollToPosition(0);
|
binding.feedRecyclerView.smoothScrollToPosition(0);
|
||||||
// binding.storiesContainer.setExpanded(true);
|
// binding.storiesContainer.setExpanded(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isSafeToNavigate(final NavController navController) {
|
private boolean isSafeToNavigate(final NavController navController) {
|
||||||
return navController.getCurrentDestination() != null
|
return navController.getCurrentDestination() != null
|
||||||
|
Loading…
Reference in New Issue
Block a user