Skip to content

Commit

Permalink
Added an isAdded() check to queryNotes().
Browse files Browse the repository at this point in the history
  • Loading branch information
roundhill committed Jan 27, 2015
1 parent f1af8d6 commit 535f539
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ public void refreshListFromNavSelect() {
}

public ObjectCursor<Note> queryNotes() {
if (!isAdded()) return null;

NotesActivity notesActivity = (NotesActivity)getActivity();
Query<Note> query = notesActivity.getSelectedTag().query();

Expand Down Expand Up @@ -688,7 +690,7 @@ protected ObjectCursor<Note> doInBackground(Boolean ... args) {

@Override
protected void onPostExecute(ObjectCursor<Note> cursor) {
if (getActivity() == null || getActivity().isFinishing())
if (cursor == null || getActivity() == null || getActivity().isFinishing())
return;

// While using a Query.FullTextMatch it's easy to enter an invalid term so catch the error and clear the cursor
Expand Down

0 comments on commit 535f539

Please sign in to comment.