summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4b9c1f6)
raw | patch | inline | side by side (parent: 4b9c1f6)
author | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 17:56:06 +0000 (19:56 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 17:56:06 +0000 (19:56 +0200) |
Don't artificially return an empty list when an error occurs.
Also don't insert the dummy ".." entry in mpdclient_filelist_get(),
screen_file.c should do this.
Also don't insert the dummy ".." entry in mpdclient_filelist_get(),
screen_file.c should do this.
src/mpdclient.c | patch | blob | history | |
src/screen_file.c | patch | blob | history |
diff --git a/src/mpdclient.c b/src/mpdclient.c
index e331544be34a3e3168ad25fcea6df859fefe8aa6..2d6598518086d5cd080d13aa949207a33a77a7aa 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
mpd_send_list_meta(c->connection, path);
filelist = filelist_new();
- if (path && path[0] && strcmp(path, "/"))
- /* add a dummy entry for ./.. */
- filelist_append(filelist, NULL);
while ((entity = mpd_recv_entity(c->connection)) != NULL)
filelist_append(filelist, entity);
- /* If there's an error, ignore it. We'll return an empty filelist. */
- mpdclient_finish_command(c);
+ if (mpdclient_finish_command(c)) {
+ filelist_free(filelist);
+ return NULL;
+ }
filelist_sort_dir_play(filelist, compare_filelistentry);
diff --git a/src/screen_file.c b/src/screen_file.c
index 78052100c9aeede306e7ad290a63b857c1de8970..31af84d8a3f6349571741a636079699d2cc0da73 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
filelist_free(browser.filelist);
browser.filelist = mpdclient_filelist_get(c, current_path);
+ if (browser.filelist == NULL)
+ browser.filelist = filelist_new();
+
+ if (*current_path != 0)
+ /* add a dummy entry for ./.. */
+ filelist_prepend(browser.filelist, NULL);
}
/* the db has changed -> update the filelist */
browse_open(G_GNUC_UNUSED struct mpdclient *c)
{
if (browser.filelist == NULL) {
- browser.filelist = mpdclient_filelist_get(c, "");
+ file_reload(c);
+
#ifndef NCMPC_MINI
mpdclient_install_playlist_callback(c, playlist_changed_callback);
#endif