From: Kalle Wallin Date: Sun, 19 Dec 2004 13:04:18 +0000 (+0000) Subject: Bugfix from Niko Tyni, find operation with wrap turned on in an empty list X-Git-Tag: v0.12_alpha1~449 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=31126ced9b1521c560d6e7f601df434c7dbd7c9f;p=ncmpc.git 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 --- diff --git a/src/list_window.c b/src/list_window.c index b541ac7..c6f5375 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)) )