From 262019b93fb27d730837609347d458c07faf5099 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 1 Oct 2009 23:58:27 +0200 Subject: [PATCH] screen_file: check connection in screen_file_cmd() --- src/screen_file.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) 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; } -- 2.30.2