commit 93400ec8a19a868442a0f60ae555759d3bb80600
parent 0d85a798e5c8d376af7de28038ec3b847aac5bdf
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 24 Feb 2022 11:57:56 +0100
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.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/text.c b/src/text.c
@@ -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;