diff --git a/ChangeLog b/ChangeLog
index 4907cf517619febb80b570c87040c059af570d4f..493ce6a23d6970c97c8a5e81cdc7c3e843b1488a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
 	every keystroke in a burst, but just once.
 	* src/text.c (do_undo): Warn about a condition that should never
 	occur, instead of silently continuing.
+	* src/text.c (do_undo): Elide an unneeded variable, and don't skip
+	the end of this function when things went wrong.
 
 2015-11-24  Benno Schulenberg  <bensberg@justemail.net>
 	* doc/syntax/makefile.nanorc: Also recognize the extensions .make and
diff --git a/src/text.c b/src/text.c
index fe6910ed93c8ff2482d92bbc7ec6151de0352785..fb8631499c050fdf27d2479e7834c52896331941 100644
--- a/src/text.c
+++ b/src/text.c
@@ -563,18 +563,17 @@ void do_undo(void)
 	f = fsfromline(u->lineno);
 	break;
     case ENTER:
-	undidmsg = _("line break");
-	filestruct *snipit = f->next;
-	if (snipit == NULL) {
+	if (f->next == NULL) {
 	    statusbar(_("Internal error: line is missing.  Please save your work."));
-	    return;
+	    break;
 	}
+	undidmsg = _("line break");
 	f->data = charealloc(f->data, strlen(f->data) +
 				strlen(&f->next->data[u->mark_begin_x]) + 1);
 	strcat(f->data, &f->next->data[u->mark_begin_x]);
-	if (openfile->filebot == snipit)
+	if (openfile->filebot == f->next)
 	    openfile->filebot = f;
-	unlink_node(snipit);
+	unlink_node(f->next);
 	goto_line_posx(u->lineno, u->begin);
 	break;
     case INSERT: