Fixed nullpointerexception caused by FeedlistFragment

This commit is contained in:
daniel oeh 2013-08-15 21:29:14 +02:00
parent f42746555e
commit c2a5f583e9
1 changed files with 11 additions and 6 deletions

View File

@ -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<Void, Void, List[]> loadTask = new AsyncTask<Void, Void, List[]>() {
@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);