fix IllegalStateException

This commit is contained in:
Chumva 2018-05-24 17:55:22 +03:00
parent c7d77a1373
commit bad6f228a3
2 changed files with 3 additions and 2 deletions

View file

@ -83,7 +83,7 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Trav
@Override
public void savedArticlesUpdated() {
if (adapter != null) {
if (adapter != null && getActivity() != null) {
List<Object> newItems = getItems();
SavedArticlesDiffCallback diffCallback = new SavedArticlesDiffCallback(adapter.getItems(), newItems);
DiffUtil.DiffResult diffRes = DiffUtil.calculateDiff(diffCallback);

View file

@ -298,7 +298,8 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
private void updateFragments() {
ExploreTabFragment exploreTabFragment = getExploreTabFragment();
SavedArticlesTabFragment savedArticlesTabFragment = getSavedArticlesTabFragment();
if (exploreTabFragment != null && savedArticlesTabFragment != null) {
if (exploreTabFragment != null && savedArticlesTabFragment != null
&& exploreTabFragment.isAdded() && savedArticlesTabFragment.isAdded()) {
exploreTabFragment.populateData();
savedArticlesTabFragment.savedArticlesUpdated();
updateNeeded = false;