From: Thomas Jansen Date: Sun, 13 Sep 2009 09:47:25 +0000 (+0200) Subject: screen_play: fix segfault during search X-Git-Tag: release-0.15~13 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=eb97953fd4a4907004cb98b57bd8e59db0962c04;p=ncmpc.git screen_play: fix segfault during search second_column may be NULL (e.g. during search), check before dereferencing it. --- 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;