From bb4da948c71355d66d248c861ed9e6ff9a7bb5b0 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Sun, 18 Mar 2018 16:57:25 +0000
Subject: [PATCH] Only unlock/save the config if it's been opened. Fixes errors
 on sessions that do not authenticate before disconnecting.

---
 exec/imapservice.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/exec/imapservice.js b/exec/imapservice.js
index bb17fd4712..74c03e677b 100644
--- a/exec/imapservice.js
+++ b/exec/imapservice.js
@@ -1303,8 +1303,10 @@ function unlock_cfg()
 function exit_func()
 {
 	close_sub();
-	unlock_cfg();
-	save_cfg(true);
+	if (cfgile !== undefined) {
+		unlock_cfg();
+		save_cfg(true);
+	}
 }
 
 function binify(seen)
-- 
GitLab