From e4cef3086bda192c9eec543e9e70950ab990b307 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 4 Mar 2018 12:55:15 +0100 Subject: [PATCH] tweaks: drop an assert, add a warning, and change a 'for' to a 'while' --- src/nano.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/nano.c b/src/nano.c index 7ad28f60..be77c9e6 100644 --- a/src/nano.c +++ b/src/nano.c @@ -179,15 +179,17 @@ void renumber(filestruct *line) { ssize_t number; - if (line == NULL) + if (line == NULL) { + statusline(ALERT, "Trying to renumber nothing -- please report a bug"); return; + } number = (line->prev == NULL) ? 0 : line->prev->lineno; - assert(line != line->next); - - for (; line != NULL; line = line->next) + while (line != NULL) { line->lineno = ++number; + line = line->next; + } } /* Partition the current buffer so that it appears to begin at (top, top_x)