Code

main: check for strfsong() failure, add fallback
[ncmpc.git] / src / main.c
index 8bfa03a86cff4bc8c0e9e06a55f7660b13159bf1..72a9362e53e2cee8f3766484e32a9739765b1dfc 100644 (file)
@@ -26,8 +26,8 @@
 #include "command.h"
 #include "ncu.h"
 #include "screen.h"
-#include "screen_utils.h"
 #include "screen_status.h"
+#include "xterm_title.h"
 #include "strfsong.h"
 #include "i18n.h"
 #include "player_command.h"
@@ -78,12 +78,15 @@ update_xterm_title(void)
        if (options.xterm_title_format && mpd->playing && song)
                strfsong(tmp, BUFSIZE, options.xterm_title_format, song);
        else
+               *tmp = 0;
+
+       if (*tmp == 0)
                g_strlcpy(tmp, PACKAGE " version " VERSION, BUFSIZE);
 
        static char title[BUFSIZE];
        if (strncmp(title, tmp, BUFSIZE)) {
                g_strlcpy(title, tmp, BUFSIZE);
-               set_xterm_title("%s", title);
+               set_xterm_title(title);
        }
 }
 #endif
@@ -114,11 +117,7 @@ disable_update_timer(void)
 static bool
 should_enable_update_timer(void)
 {
-       return mpd->playing
-#ifndef NCMPC_MINI
-               || options.display_time
-#endif
-               ;
+       return mpd->playing;
 }
 
 static void