summaryrefslogtreecommitdiff
path: root/src/de/podfetcher/feed
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-06-26 13:17:48 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2012-06-26 13:17:48 +0200
commit6488e7982725f3174035e0c6562bae425a204c9a (patch)
tree2b1b48514ec83e9cab29131085e427f155567f45 /src/de/podfetcher/feed
parent2148189430452decb6abc5a75dd149eb3a68f308 (diff)
downloadAntennaPod-6488e7982725f3174035e0c6562bae425a204c9a.zip
Fixed bug that caused the application to crash when playing the last
played media of a feed that was already deleted
Diffstat (limited to 'src/de/podfetcher/feed')
-rw-r--r--src/de/podfetcher/feed/FeedManager.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/de/podfetcher/feed/FeedManager.java b/src/de/podfetcher/feed/FeedManager.java
index a9eb4e015..745ebf461 100644
--- a/src/de/podfetcher/feed/FeedManager.java
+++ b/src/de/podfetcher/feed/FeedManager.java
@@ -145,9 +145,10 @@ public class FeedManager {
unreadItems.add(item);
}
}
-
- /**
+
+ /**
* Sets the 'read' attribute of all FeedItems of a specific feed to true
+ *
* @param context
*/
public void markFeedRead(Context context, Feed feed) {
@@ -323,12 +324,15 @@ public class FeedManager {
/** Get a FeedMedia object by the id of the Media object and the feed object */
public FeedMedia getFeedMedia(long id, Feed feed) {
- for (FeedItem item : feed.getItems()) {
- if (item.getMedia().getId() == id) {
- return item.getMedia();
+ if (feed != null) {
+ for (FeedItem item : feed.getItems()) {
+ if (item.getMedia().getId() == id) {
+ return item.getMedia();
+ }
}
}
Log.e(TAG, "Couldn't find FeedMedia with id " + id);
+ if (feed == null) Log.e(TAG, "Feed was null");
return null;
}
@@ -371,7 +375,7 @@ public class FeedManager {
}
private void extractFeedlistFromCursor(Context context, PodDBAdapter adapter) {
-
+
Cursor feedlistCursor = adapter.getAllFeedsCursor();
if (feedlistCursor.moveToFirst()) {
do {
@@ -407,7 +411,7 @@ public class FeedManager {
} while (feedlistCursor.moveToNext());
}
feedlistCursor.close();
-
+
}
private ArrayList<FeedItem> extractFeedItemsFromCursor(Context context,
@@ -447,7 +451,8 @@ public class FeedManager {
return items;
}
- private void extractDownloadLogFromCursor(Context context, PodDBAdapter adapter) {
+ private void extractDownloadLogFromCursor(Context context,
+ PodDBAdapter adapter) {
Cursor logCursor = adapter.getDownloadLogCursor();
if (logCursor.moveToFirst()) {
do {