execute: don't crash when an empty buffer is piped through a command

That is, take into account that the cutbuffer could be NULL
(when updating the undo item).

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

Bug existed since version 4.9, commit b15c5a7e.
This commit is contained in:
Benno Schulenberg 2022-02-24 11:57:56 +01:00
parent 0d85a798e5
commit 93400ec8a1

View File

@ -1177,7 +1177,8 @@ void update_undo(undo_type action)
else if (cutbuffer != NULL) {
free_lines(u->cutbuffer);
u->cutbuffer = copy_buffer(cutbuffer);
}
} else
break;
if (!(u->xflags & MARK_WAS_SET)) {
linestruct *bottomline = u->cutbuffer;
size_t count = 0;