X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fscreen_browser.c;h=04673f4e85a7e5632525a3cf19820fcab1d80ad6;hb=7fa7a969f4a78792ecfe2c395c02b1d119c1bc48;hp=49827647d6e8f0898032fbad629c3b69b6e3a6e9;hpb=0796b270b1699336f29908d11bca92d64da0653c;p=ncmpc.git diff --git a/src/screen_browser.c b/src/screen_browser.c index 4982764..04673f4 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -17,6 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "config.h" #include "screen_browser.h" #include "screen_file.h" #include "screen_song.h" @@ -44,8 +45,6 @@ #define HIGHLIGHT (0x01) #endif -static const char playlist_format[] = "*%s*"; - #ifndef NCMPC_MINI /* sync highlight flags with playlist */ @@ -111,7 +110,7 @@ browser_lw_callback(unsigned idx, void *data) mpd_entity_get_playlist(entity); char *filename = utf8_to_locale(g_basename(mpd_playlist_get_path(playlist))); - g_snprintf(buf, BUFSIZE, playlist_format, filename); + g_strlcpy(buf, filename, sizeof(buf)); g_free(filename); return buf; } @@ -144,6 +143,9 @@ static bool enqueue_and_play(struct mpdclient *c, struct filelist_entry *entry) { struct mpd_connection *connection = mpdclient_get_connection(c); + if (connection == NULL) + return false; + const struct mpd_song *song = mpd_entity_get_song(entry->entity); int id;