From eb97953fd4a4907004cb98b57bd8e59db0962c04 Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Sun, 13 Sep 2009 11:47:25 +0200 Subject: [PATCH] screen_play: fix segfault during search second_column may be NULL (e.g. during search), check before dereferencing it. --- src/screen_play.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/screen_play.c b/src/screen_play.c index 3f79ad7..8683ee0 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -129,7 +129,10 @@ list_callback(unsigned idx, bool *highlight, char **second_column, G_GNUC_UNUSED if (idx == lw->selected) { - if (options.scroll && utf8_width(songname) > (unsigned)(COLS - strlen(*second_column) - 1) ) + int second_column_len = 0; + if (second_column) + second_column_len = strlen(*second_column); + if (options.scroll && utf8_width(songname) > (unsigned)(COLS - second_column_len - 1) ) { static unsigned current_song; char *tmp; -- 2.30.2