undo: do not try to paste back an empty cutbuffer

Trying to do so would dereference a NULL pointer in copy_node().

This fixes https://savannah.gnu.org/bugs/?57915.

Bug existed since before version 2.2.0.
master
Benno Schulenberg 2020-02-28 12:52:06 +01:00
parent 1a28b08694
commit 0568f7a2b6
1 changed files with 2 additions and 1 deletions

View File

@ -762,7 +762,8 @@ void do_redo(void)
case INSERT:
redidmsg = _("insertion");
goto_line_posx(u->head_lineno, u->head_x);
copy_from_buffer(u->cutbuffer);
if (u->cutbuffer)
copy_from_buffer(u->cutbuffer);
free_lines(u->cutbuffer);
u->cutbuffer = NULL;
break;