aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-12-19 13:04:18 +0000
committerKalle Wallin <kaw@linux.se>2004-12-19 13:04:18 +0000
commit31126ced9b1521c560d6e7f601df434c7dbd7c9f (patch)
tree925704bd311f180cd2651648ac44e2a0bde7dedb /src
parent03cc74cb251535808dbf08e1680f0b6f1feead92 (diff)
downloadmpd-31126ced9b1521c560d6e7f601df434c7dbd7c9f.tar.gz
mpd-31126ced9b1521c560d6e7f601df434c7dbd7c9f.tar.xz
mpd-31126ced9b1521c560d6e7f601df434c7dbd7c9f.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/list_window.c5
1 files changed, 5 insertions, 0 deletions
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)) )