Code

screen_song: don't show unknown kbit rates
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Sat, 19 Nov 2011 01:33:43 +0000 (02:33 +0100)
committerMax Kellermann <max@duempel.org>
Fri, 2 Dec 2011 11:08:34 +0000 (12:08 +0100)
(calling mpd_status_get_kbit_rate twice in a row shouldn't impact
performance, it's declared as "pure")

src/screen_song.c

index e738fc2914f9eb4f57faec1220ea54e38ff9d82b..9154f9ab1379ffe9b4a48b7dc6319e1a0511c655 100644 (file)
@@ -311,7 +311,8 @@ screen_song_add_song(const struct mpd_song *song, const struct mpdclient *c)
        screen_song_append(_("Path"), mpd_song_get_uri(song),
                           max_tag_label_width);
        if (mpdclient_is_playing(c) && c->song != NULL &&
-           strcmp(mpd_song_get_uri(c->song), mpd_song_get_uri(song)) == 0) {
+           strcmp(mpd_song_get_uri(c->song), mpd_song_get_uri(song)) == 0 &&
+           mpd_status_get_kbit_rate(c->status)) {
                char buf[16];
                g_snprintf(buf, sizeof(buf), _("%d kbps"),
                           mpd_status_get_kbit_rate(c->status));