Skip to content

Commit

Permalink
re-arranged if checks to only try getting selected site if fragment i…
Browse files Browse the repository at this point in the history
…s added, then checked for site != null to avoid NPE
  • Loading branch information
mzorz committed Jul 31, 2017
1 parent 935de72 commit 28a9d58
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,14 @@ public void onSiteChanged(OnSiteChanged event) {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPostUploaded(PostStore.OnPostUploaded event) {
final PostModel post = event.post;
SiteModel site = getSelectedSite();
if (isAdded() && event.post != null && event.post.getLocalSiteId() == site.getId()) {
UploadUtils.onPostUploadedSnackbarHandler(getActivity(),
getActivity().findViewById(R.id.coordinator), event, site, mDispatcher);
if (isAdded() && event.post != null) {
SiteModel site = getSelectedSite();
if (site != null) {
if (event.post.getLocalSiteId() == site.getId()) {
UploadUtils.onPostUploadedSnackbarHandler(getActivity(),
getActivity().findViewById(R.id.coordinator), event, site, mDispatcher);
}
}
}
}
}

0 comments on commit 28a9d58

Please sign in to comment.