Code

check the return value of mpdclient_get_connection()
[ncmpc.git] / src / screen_file.c
index d9faa69ac66430032a736b971de0211b9a8db7dc..67dc3e081182da8addac2436b3b77b54103b1e8b 100644 (file)
@@ -56,10 +56,9 @@ screen_file_load_list(struct mpdclient *c, struct filelist *filelist)
 {
        struct mpd_connection *connection;
 
-       if (!mpdclient_is_connected(c))
-               return;
-
        connection = mpdclient_get_connection(c);
+       if (connection == NULL)
+               return;
 
        mpd_send_list_meta(connection, current_path);
        filelist_recv(filelist, connection);
@@ -209,6 +208,9 @@ handle_delete(struct mpdclient *c)
        char *str, *buf;
        int key;
 
+       if (connection == NULL)
+               return;
+
        list_window_get_range(browser.lw, &range);
        for (unsigned i = range.start; i < range.end; ++i) {
                struct filelist_entry *entry =