From: Max Kellermann Date: Thu, 1 Oct 2009 21:58:27 +0000 (+0200) Subject: screen_file: check connection in screen_file_cmd() X-Git-Tag: release-0.16~226 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=262019b93fb27d730837609347d458c07faf5099;p=ncmpc.git screen_file: check connection in screen_file_cmd() --- diff --git a/src/screen_file.c b/src/screen_file.c index b36c265..116d329 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -350,13 +350,6 @@ screen_file_cmd(struct mpdclient *c, command_t cmd) segmentation fault in the current implementation */ return false; - case CMD_DELETE: - handle_delete(c); - screen_file_repaint(); - break; - case CMD_SAVE_PLAYLIST: - handle_save(c); - break; case CMD_SCREEN_UPDATE: screen_file_reload(c); #ifndef NCMPC_MINI @@ -367,13 +360,6 @@ screen_file_cmd(struct mpdclient *c, command_t cmd) screen_file_repaint(); return false; - case CMD_DB_UPDATE: - if (c->status == NULL) - return true; - - screen_database_update(c, current_path); - return true; - default: break; } @@ -384,6 +370,27 @@ screen_file_cmd(struct mpdclient *c, command_t cmd) return true; } + if (!mpdclient_is_connected(c)) + return false; + + switch(cmd) { + case CMD_DELETE: + handle_delete(c); + screen_file_repaint(); + break; + + case CMD_SAVE_PLAYLIST: + handle_save(c); + break; + + case CMD_DB_UPDATE: + screen_database_update(c, current_path); + return true; + + default: + break; + } + return false; }