From 6d47d7232f192d203d4fc76af3e3fb191a157d5c Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Mon, 28 Mar 2016 19:59:42 -0400 Subject: [PATCH] Fixed null pointer exception --- .../browser/lightning/fragment/BookmarksFragment.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java b/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java index 86d66bf..feaa6db 100644 --- a/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java +++ b/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java @@ -98,9 +98,13 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener, return Observable.create(new Action() { @Override public void onSubscribe(@NonNull Subscriber subscriber) { - mBookmarkAdapter = new BookmarkViewAdapter(getContext(), mBookmarks); - setBookmarkDataSet(mBookmarkManager.getBookmarksFromFolder(null, true), false); - subscriber.onNext(mBookmarkAdapter); + Context context = getContext(); + if (context != null) { + mBookmarkAdapter = new BookmarkViewAdapter(getContext(), mBookmarks); + setBookmarkDataSet(mBookmarkManager.getBookmarksFromFolder(null, true), false); + subscriber.onNext(mBookmarkAdapter); + } + subscriber.onComplete(); } }); }