From: Max Kellermann Date: Wed, 8 Jul 2009 21:09:30 +0000 (+0200) Subject: screen_play: fix duration "0:-1" X-Git-Tag: release-0.15~43 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=13b9b084c18d675f7ea52b750f22426473888e2a;p=ncmpc.git screen_play: fix duration "0:-1" If the song duration is not known (MPD_SONG_NO_TIME), don't attempt to print -1 in the second column. --- diff --git a/src/screen_play.c b/src/screen_play.c index f41f32a..e194466 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -99,6 +99,9 @@ playlist_changed_callback(mpdclient_t *c, int event, gpointer data) static char * format_duration(int duration) { + if (duration == MPD_SONG_NO_TIME) + return NULL; + return g_strdup_printf("%d:%02d", duration / 60, duration % 60); }