Commit 4d9b5e92 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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
No related merge requests found
Showing with 9 additions and 5 deletions
+9 -5
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> 2015-03-08 Benno Schulenberg <bensberg@justemail.net>
* src/proto.h, src/nano.c: Fix compilation with --enable-tiny plus * src/proto.h, src/nano.c: Fix compilation with --enable-tiny plus
--enable-nanorc. --enable-nanorc.
......
...@@ -178,7 +178,8 @@ void renumber(filestruct *fileptr) ...@@ -178,7 +178,8 @@ void renumber(filestruct *fileptr)
{ {
ssize_t line; ssize_t line;
assert(fileptr != NULL); if (fileptr == NULL)
return;
line = (fileptr->prev == NULL) ? 0 : fileptr->prev->lineno; line = (fileptr->prev == NULL) ? 0 : fileptr->prev->lineno;
...@@ -365,7 +366,6 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot, ...@@ -365,7 +366,6 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
/* Renumber starting with the line after the original /* Renumber starting with the line after the original
* file_bot. */ * file_bot. */
if (file_bot_save->next != NULL)
renumber(file_bot_save->next); renumber(file_bot_save->next);
} }
......
...@@ -1373,7 +1373,6 @@ void update_history(filestruct **h, const char *s) ...@@ -1373,7 +1373,6 @@ void update_history(filestruct **h, const char *s)
bar = p->next; bar = p->next;
unlink_node(foo); unlink_node(foo);
delete_node(foo); delete_node(foo);
if (bar != NULL)
renumber(bar); renumber(bar);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment