1
0
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:
Austin Huang 2021-05-15 20:40:02 -04:00 committed by GitHub
parent fc70129c96
commit 23b7119846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -458,9 +458,11 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
}
public void scrollToTop() {
if (binding != null) {
binding.feedRecyclerView.smoothScrollToPosition(0);
// binding.storiesContainer.setExpanded(true);
}
}
private boolean isSafeToNavigate(final NavController navController) {
return navController.getCurrentDestination() != null