Fixed bug that occured when restoring the queue from the DB

This commit is contained in:
daniel oeh 2012-06-21 21:16:17 +02:00
parent eeeff62037
commit 940f133e4c
1 changed files with 4 additions and 1 deletions

View File

@ -262,6 +262,7 @@ public class FeedManager {
return f; return f;
} }
} }
Log.e(TAG, "Couldn't find Feed with id " + id);
return null; return null;
} }
@ -444,6 +445,7 @@ public class FeedManager {
} while (logCursor.moveToNext()); } while (logCursor.moveToNext());
} }
adapter.close();
} }
private void extractQueueFromCursor(Context context) { private void extractQueueFromCursor(Context context) {
@ -453,11 +455,12 @@ public class FeedManager {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
do { do {
int index = cursor.getInt(cursor.getColumnIndex(PodDBAdapter.KEY_ID)); int index = cursor.getInt(cursor.getColumnIndex(PodDBAdapter.KEY_ID));
Feed feed = getFeed(cursor.getColumnIndex(PodDBAdapter.KEY_FEED)); Feed feed = getFeed(cursor.getLong(cursor.getColumnIndex(PodDBAdapter.KEY_FEED)));
FeedItem item = getFeedItem(cursor.getColumnIndex(PodDBAdapter.KEY_FEEDITEM), feed); FeedItem item = getFeedItem(cursor.getColumnIndex(PodDBAdapter.KEY_FEEDITEM), feed);
queue.add(index, item); queue.add(index, item);
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
adapter.close();
} }
public ArrayList<Feed> getFeeds() { public ArrayList<Feed> getFeeds() {