Getting out if there is nothing to renumber,

to prevent do_undo() from falling over when trying to renumber emptiness.
Patch basically by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5137 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2015-03-14 15:59:01 +00:00
parent 18a2edfb84
commit 4d9b5e92b3
3 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2015-03-14 Mark Majeres <mark@engine12.com>
* src/nano.c (renumber): Get out if there is nothing to renumber.
This prevents do_undo() from falling over when trying to renumber
emptiness. This fixes Savannah bug #44488, reported by Dennis.
2015-03-08 Benno Schulenberg <bensberg@justemail.net>
* src/proto.h, src/nano.c: Fix compilation with --enable-tiny plus
--enable-nanorc.

View File

@ -178,7 +178,8 @@ void renumber(filestruct *fileptr)
{
ssize_t line;
assert(fileptr != NULL);
if (fileptr == NULL)
return;
line = (fileptr->prev == NULL) ? 0 : fileptr->prev->lineno;
@ -365,8 +366,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
/* Renumber starting with the line after the original
* file_bot. */
if (file_bot_save->next != NULL)
renumber(file_bot_save->next);
renumber(file_bot_save->next);
}
/* Since the text has now been saved, remove it from the

View File

@ -1373,8 +1373,7 @@ void update_history(filestruct **h, const char *s)
bar = p->next;
unlink_node(foo);
delete_node(foo);
if (bar != NULL)
renumber(bar);
renumber(bar);
}
/* If the history is full, delete the beginning entry to make room