commit cc6efa84fd36016d0b5e84b33448c331eb0f8177
parent 568577344a2ef6600cb15af56f77d4da3a9c3cb8
Author: hhvn <dev@hhvn.uk>
Date: Tue, 9 Nov 2021 16:52:44 +0000
ui.c: fix ui_buflist_select
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/ui.c b/ui.c
@@ -381,19 +381,24 @@ ui_buflist_select(int num) {
return;
}
- for (i = 2, sp = servers; sp; sp = sp->next, i++) {
+ for (i = 2, sp = servers; sp; sp = sp->next) {
if (i == num) {
ui_select(sp, NULL);
return;
}
+ i++; /* increment before moving
+ to channel section, not
+ int for (;; ..) */
- for (i++, chp = sp->channels; chp; chp = chp->next, i++) {
+ for (chp = sp->channels; chp; chp = chp->next, i++) {
if (i == num) {
ui_select(sp, chp);
return;
}
}
}
+
+ ui_error("couldn't select buffer with index %d", num);
}
void