Browse Source

Some null checks. Fixes https://github.com/austinhuang0131/barinsta/issues/274

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
b3d41ccffa
  1. 3
      app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
  2. 3
      app/src/main/java/awais/instagrabber/fragments/LocationFragment.java
  3. 1
      app/src/main/java/awais/instagrabber/fragments/main/DiscoverFragment.java

3
app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java

@ -200,7 +200,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
Utils.openEmailAddress(getContext(), emailId); Utils.openEmailAddress(getContext(), emailId);
} }
private void openPostDialog(final FeedModel feedModel,
private void openPostDialog(@NonNull final FeedModel feedModel,
final View profilePicView, final View profilePicView,
final View mainPostImage, final View mainPostImage,
final int position) { final int position) {
@ -209,6 +209,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
opening = true; opening = true;
new PostFetcher(feedModel.getShortCode(), newFeedModel -> { new PostFetcher(feedModel.getShortCode(), newFeedModel -> {
opening = false; opening = false;
if (newFeedModel == null) return;
openPostDialog(newFeedModel, profilePicView, mainPostImage, position); openPostDialog(newFeedModel, profilePicView, mainPostImage, position);
}).execute(); }).execute();
return; return;

3
app/src/main/java/awais/instagrabber/fragments/LocationFragment.java

@ -198,7 +198,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
Utils.openEmailAddress(getContext(), emailId); Utils.openEmailAddress(getContext(), emailId);
} }
private void openPostDialog(final FeedModel feedModel,
private void openPostDialog(@NonNull final FeedModel feedModel,
final View profilePicView, final View profilePicView,
final View mainPostImage, final View mainPostImage,
final int position) { final int position) {
@ -207,6 +207,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
opening = true; opening = true;
new PostFetcher(feedModel.getShortCode(), newFeedModel -> { new PostFetcher(feedModel.getShortCode(), newFeedModel -> {
opening = false; opening = false;
if (newFeedModel == null) return;
openPostDialog(newFeedModel, profilePicView, mainPostImage, position); openPostDialog(newFeedModel, profilePicView, mainPostImage, position);
}).execute(); }).execute();
return; return;

1
app/src/main/java/awais/instagrabber/fragments/main/DiscoverFragment.java

@ -91,6 +91,7 @@ public class DiscoverFragment extends Fragment implements SwipeRefreshLayout.OnR
discoverService.topicalExplore(new DiscoverService.TopicalExploreRequest(), new ServiceCallback<DiscoverService.TopicalExploreResponse>() { discoverService.topicalExplore(new DiscoverService.TopicalExploreRequest(), new ServiceCallback<DiscoverService.TopicalExploreResponse>() {
@Override @Override
public void onSuccess(final DiscoverService.TopicalExploreResponse result) { public void onSuccess(final DiscoverService.TopicalExploreResponse result) {
if (result == null) return;
topicClusterViewModel.getList().postValue(result.getClusters()); topicClusterViewModel.getList().postValue(result.getClusters());
binding.swipeRefreshLayout.setRefreshing(false); binding.swipeRefreshLayout.setRefreshing(false);
} }

Loading…
Cancel
Save