summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fdisks/cfdisk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fdisks/cfdisk.c b/fdisks/cfdisk.c
index 7865578f1..0fd64bf61 100644
--- a/fdisks/cfdisk.c
+++ b/fdisks/cfdisk.c
@@ -1052,6 +1052,9 @@ static int ui_draw_table(struct cfdisk *cf)
clrtoeol();
}
+ if ((size_t) cf->lines_idx > nparts - 1)
+ cf->lines_idx = nparts ? nparts - 1 : 0;
+
/* print header */
attron(A_BOLD);
mvaddstr(TABLE_START_LINE, cl, cf->lines[0]);