]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - playlist.c
Implement com_select().
[paraslash.git] / playlist.c
index 1c496cae506a0289e805b1a98729b16399ab5065..9afa8128d738f9428d01b3b44d73d99f7516d239 100644 (file)
@@ -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, &current_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)