Merge pull request #5482 from osmandapp/FixException

Fix IllegalStateException
This commit is contained in:
Alexander Sytnyk 2018-05-24 18:31:43 +03:00 committed by GitHub
commit 8d7331fd93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 && isAdded()) {
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;