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
+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.
{
ssize_t line;
- assert(fileptr != NULL);
+ if (fileptr == NULL)
+ return;
line = (fileptr->prev == NULL) ? 0 : fileptr->prev->lineno;
/* 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
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