From 750471488237d7c10ee18e60d03bcbeeb441a683 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 25 Apr 2006 02:56:54 +0000
Subject: [PATCH] fix segfault if we try to copy an empty selection

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3432 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/cut.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/cut.c b/src/cut.c
index 4b458300..e3ca576e 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -161,14 +161,15 @@ void do_cut_text(
 	cut_line();
 
 #ifndef NANO_TINY
-    if (copy_text)
+    if (copy_text) {
 	/* Copy the text in the cutbuffer, starting at its saved end if
 	 * there is one, back into the filestruct.  This effectively
 	 * uncuts the text we just cut without marking the file as
 	 * modified. */
-	copy_from_filestruct((cb_save != NULL) ? cb_save : cutbuffer,
-		cutbottom);
-    else
+	if (cutbuffer != NULL)
+	    copy_from_filestruct((cb_save != NULL) ? cb_save :
+		cutbuffer, cutbottom);
+    } else
 #endif
 	/* Leave the text in the cutbuffer, and mark the file as
 	 * modified. */
-- 
GitLab