Allow empty playlists

This commit is contained in:
Ron Pedde 2004-09-15 03:14:56 +00:00
parent 9727812201
commit d9d0acd412
2 changed files with 16 additions and 3 deletions

View File

@ -897,8 +897,10 @@ DAAP_BLOCK *daap_response_playlist_items(unsigned int playlist, char* metaStr, c
henum=db_playlist_items_enum_begin(playlist); henum=db_playlist_items_enum_begin(playlist);
} }
/* we can allow an empty playlist...
if(!henum) if(!henum)
return NULL; return NULL;
*/
root=daap_add_empty(NULL,"apso"); root=daap_add_empty(NULL,"apso");
if(root) { if(root) {

View File

@ -923,8 +923,14 @@ ENUMHANDLE db_playlist_items_enum_begin(int playlistid) {
* Walk to the next entry * Walk to the next entry
*/ */
MP3FILE *db_enum(ENUMHANDLE *current) { MP3FILE *db_enum(ENUMHANDLE *current) {
MP3HELPER* helper = *(MP3HELPER**) current; MP3HELPER* helper;
MP3RECORD* record = helper->next; MP3RECORD* record;
if(!current)
return 0;
helper = *(MP3HELPER**) current;
record = helper->next;
if(helper->next == 0) if(helper->next == 0)
return 0; return 0;
@ -963,9 +969,14 @@ int db_playlist_enum(ENUMHANDLE* handle) {
* walk to the next entry * walk to the next entry
*/ */
int db_playlist_items_enum(ENUMHANDLE* handle) { int db_playlist_items_enum(ENUMHANDLE* handle) {
DB_PLAYLISTENTRY **current = (DB_PLAYLISTENTRY**) handle; DB_PLAYLISTENTRY **current;
int retval; int retval;
if(!handle)
return -1;
current = (DB_PLAYLISTENTRY**) handle;
if(*current) { if(*current) {
retval = (*current)->id; retval = (*current)->id;
*current=(*current)->next; *current=(*current)->next;