Code

screen_file: check connection in screen_file_cmd()
authorMax Kellermann <max@duempel.org>
Thu, 1 Oct 2009 21:58:27 +0000 (23:58 +0200)
committerMax Kellermann <max@duempel.org>
Thu, 1 Oct 2009 21:58:27 +0000 (23:58 +0200)
src/screen_file.c

index b36c265031ea35279f7b14c88293d2159b0eeca2..116d32937bd31337986096b60ea7a3e09505352f 100644 (file)
@@ -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;
 }