1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

no infinite loops please

This commit is contained in:
Ailin Nemui 2022-09-22 22:25:02 +02:00
parent 55913ade13
commit 093dcd423f

View File

@ -1629,6 +1629,7 @@ static int window_refnum_left(int refnum, int wrap)
{ {
MAIN_WINDOW_REC *find_sticky; MAIN_WINDOW_REC *find_sticky;
WINDOW_REC *window; WINDOW_REC *window;
int start_refnum = refnum;
window = window_find_refnum(refnum); window = window_find_refnum(refnum);
g_return_val_if_fail(window != NULL, -1); g_return_val_if_fail(window != NULL, -1);
@ -1638,7 +1639,7 @@ static int window_refnum_left(int refnum, int wrap)
do { do {
refnum = window_refnum_prev(refnum, wrap); refnum = window_refnum_prev(refnum, wrap);
if (refnum < 0) if (refnum < 0 || refnum == start_refnum)
break; break;
window = window_find_refnum(refnum); window = window_find_refnum(refnum);
@ -1651,6 +1652,7 @@ static int window_refnum_right(int refnum, int wrap)
{ {
MAIN_WINDOW_REC *find_sticky; MAIN_WINDOW_REC *find_sticky;
WINDOW_REC *window; WINDOW_REC *window;
int start_refnum = refnum;
window = window_find_refnum(refnum); window = window_find_refnum(refnum);
g_return_val_if_fail(window != NULL, -1); g_return_val_if_fail(window != NULL, -1);
@ -1660,7 +1662,7 @@ static int window_refnum_right(int refnum, int wrap)
do { do {
refnum = window_refnum_next(refnum, wrap); refnum = window_refnum_next(refnum, wrap);
if (refnum < 0) if (refnum < 0 || refnum == start_refnum)
break; break;
window = window_find_refnum(refnum); window = window_find_refnum(refnum);