X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=playlist.c;h=9afa8128d738f9428d01b3b44d73d99f7516d239;hb=d894e0cc7ce94d09847a8a35f47127968d4268f1;hp=1c496cae506a0289e805b1a98729b16399ab5065;hpb=8d45d703078c89bb89804dacb6706f0c563ac4c6;p=paraslash.git diff --git a/playlist.c b/playlist.c index 1c496cae..9afa8128 100644 --- a/playlist.c +++ b/playlist.c @@ -144,6 +144,10 @@ int playlist_check_callback(__a_unused const struct osl_object *query, */ void playlist_close(void) { + int ret; + + if (!current_playlist.name) + return; free(current_playlist.name); current_playlist.name = NULL; } @@ -171,8 +175,9 @@ int playlist_open(char *name) PARA_NOTICE_LOG("failed to load playlist %s\n", name); return ret; } + playlist_close(); ret = load_playlist(row, ¤t_playlist); - return (ret == -E_PLAYLIST_LOADED)? 1 : ret; + return (ret == -E_PLAYLIST_LOADED)? current_playlist.length : ret; } static int search_path(char *path, void *data)