From 31126ced9b1521c560d6e7f601df434c7dbd7c9f Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Sun, 19 Dec 2004 13:04:18 +0000 Subject: Bugfix from Niko Tyni, find operation with wrap turned on in an empty list resulted in an infinite loop git-svn-id: https://svn.musicpd.org/ncmpc/trunk@2806 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/list_window.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/list_window.c b/src/list_window.c index b541ac708..c6f5375a1 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -245,6 +245,8 @@ list_window_find(list_window_t *lw, } if( wrap ) { + if ( i==0 ) /* empty list */ + return 1; i=0; /* first item */ screen_bell(); } @@ -265,6 +267,9 @@ list_window_rfind(list_window_t *lw, int i = lw->selected-1; char *label; + if ( rows == 0 ) + return 1; + while( wrap || i==lw->selected-1 ) { while( i>=0 && (label=(callback) (i,&h,callback_data)) ) -- cgit v1.2.3