From f7eef5d04c0128e424ada800af199c2b0eb06dd0 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 27 Nov 2006 05:49:58 +0000
Subject: [PATCH] fix breakage

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

diff --git a/src/files.c b/src/files.c
index f67a5a20..01675d1b 100644
--- a/src/files.c
+++ b/src/files.c
@@ -728,8 +728,10 @@ void do_insertfile(
 		"./");
 
 	/* If we're in multibuffer mode and the filename or command is
-	 * blank, open a new buffer instead of canceling. */
-	if (i == -1 || (i == -2
+	 * blank, open a new buffer instead of canceling.  If the
+	 * filename or command begins with an unsunder()ed null, treat
+	 * it as though it's blank. */
+	if (i == -1 || ((i == -2 || answer[0] == '\n')
 #ifdef ENABLE_MULTIBUFFER
 		&& !ISSET(MULTIBUFFER)
 #endif
@@ -1819,7 +1821,9 @@ int do_writeout(bool exiting)
 #endif
 		);
 
-	if (i < 0) {
+	/* If the filename or command begins with an unsunder()ed null,
+	 * treat it as though it's blank. */
+	if (i < 0 || answer[0] == '\n') {
 	    statusbar(_("Cancelled"));
 	    retval = -1;
 	    break;
-- 
GitLab