Fix possible NPE

This commit is contained in:
Alex Sytnyk 2018-05-03 11:37:59 +03:00
parent 85349dbbd8
commit 01ae2bed08

View file

@ -3,6 +3,7 @@ package net.osmand.plus.wikivoyage.explore;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v7.util.DiffUtil; import android.support.v7.util.DiffUtil;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
@ -45,8 +46,9 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Trav
adapter.setListener(new SavedArticlesRvAdapter.Listener() { adapter.setListener(new SavedArticlesRvAdapter.Listener() {
@Override @Override
public void openArticle(TravelArticle article) { public void openArticle(TravelArticle article) {
FragmentManager fm = getActivity().getSupportFragmentManager(); FragmentActivity activity = getActivity();
if (fm != null) { if (activity != null) {
FragmentManager fm = activity.getSupportFragmentManager();
WikivoyageArticleDialogFragment.showInstance(app, fm, article.getCityId(), article.getLang()); WikivoyageArticleDialogFragment.showInstance(app, fm, article.getCityId(), article.getLang());
} }
} }