Code

mpdclient: wrap access in mpdclient_get_connection()
[ncmpc.git] / src / screen_song.c
index 1de01f48ecad5f728593e249225ee0072f3c0d75..9d42eb47e1d9cb6e02734b3f76d1ce724e9769ff 100644 (file)
@@ -371,10 +371,9 @@ screen_song_update(struct mpdclient *c)
        }
 
        /* Add some statistics about mpd */
-       if (mpdclient_is_connected(c)) {
-               if (!screen_song_add_stats(c->connection))
-                       mpdclient_handle_error(c);
-       }
+       if (mpdclient_is_connected(c) &&
+           !screen_song_add_stats(mpdclient_get_connection(c)))
+               mpdclient_handle_error(c);
 
        screen_song_repaint();
 }