Code

screen_play: fix segfault during search
authorThomas Jansen <mithi@mithi.net>
Sun, 13 Sep 2009 09:47:25 +0000 (11:47 +0200)
committerThomas Jansen <mithi@mithi.net>
Sun, 13 Sep 2009 09:47:25 +0000 (11:47 +0200)
second_column may be NULL (e.g. during search), check before dereferencing it.

src/screen_play.c

index 3f79ad75f7e71ed20ea5295ab37c6fa6ef4af146..8683ee013d7c1ef6e53de4d888778c90ff40f091 100644 (file)
@@ -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;