From c2a5f583e9bf885258df95b8b58d35fa9162d697 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Thu, 15 Aug 2013 21:29:14 +0200 Subject: Fixed nullpointerexception caused by FeedlistFragment --- src/de/danoeh/antennapod/fragment/FeedlistFragment.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/de/danoeh/antennapod/fragment/FeedlistFragment.java b/src/de/danoeh/antennapod/fragment/FeedlistFragment.java index 19a14299e..0e06e546e 100644 --- a/src/de/danoeh/antennapod/fragment/FeedlistFragment.java +++ b/src/de/danoeh/antennapod/fragment/FeedlistFragment.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.fragment; import java.util.List; import android.annotation.SuppressLint; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.AsyncTask; @@ -29,9 +30,9 @@ import de.danoeh.antennapod.storage.FeedItemStatistics; import de.danoeh.antennapod.util.menuhandler.FeedMenuHandler; public class FeedlistFragment extends Fragment implements - ActionMode.Callback, AdapterView.OnItemClickListener, - AdapterView.OnItemLongClickListener { - private static final String TAG = "FeedlistFragment"; + ActionMode.Callback, AdapterView.OnItemClickListener, + AdapterView.OnItemLongClickListener { + private static final String TAG = "FeedlistFragment"; private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED | EventDistributor.DOWNLOAD_QUEUED @@ -94,12 +95,16 @@ public class FeedlistFragment extends Fragment implements AsyncTask loadTask = new AsyncTask() { @Override protected List[] doInBackground(Void... params) { - return new List[]{DBReader.getFeedList(getActivity()), - DBReader.getFeedStatisticsList(getActivity())}; + Context context = getActivity(); + if (context != null) { + return new List[]{DBReader.getFeedList(context), + DBReader.getFeedStatisticsList(context)}; + } else { + return null; + } } - @Override protected void onPostExecute(List[] result) { super.onPostExecute(result); -- cgit v1.2.3