From 5cce53b5a858a77a2fc600bcc0ff3760ad88504c Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Tue, 17 Jul 2001 10:42:50 +0000
Subject: [PATCH] do_writeout() - Check for open_files == NULL before using it
 (Ryan Krebs)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@734 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog | 3 +++
 files.c   | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 9f6958f6..f67198a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@ CVS code -
 - nano.c:
   main()
 	- Change the getop option to 'F' (David Lawrence Ramsey)
+- files.c:
+  do_writeout()
+	- Check for open_files == NULL before using it (Ryan Krebs)
 - global.c:
   shortcut_init()
 	- Rewrote the whereis and replace lists to put CANCEL at the end
diff --git a/files.c b/files.c
index 3b804a57..f35e69ae 100644
--- a/files.c
+++ b/files.c
@@ -1168,7 +1168,7 @@ int do_writeout(char *path, int exiting, int append)
 		   update the filename and full path stored in the
 		   current entry, and then update the current entry,
 		   checking for duplicate entries */
-		if (strcmp(open_files->data, filename)) {
+		if (open_files != NULL && strcmp(open_files->data, filename)) {
 		    open_file_change_name();
 		    add_open_file(1, 1);
 		}
-- 
GitLab