From 07b421874fe3afc75af7a8339b8f91c328799947 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Sun, 2 Apr 2023 14:15:43 -0700
Subject: [PATCH] Fix issue with the (new) backup_level option parsing

Error: can't covert options.backup_level to an integer

Default to 10, if not set.
---
 exec/automsg.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/exec/automsg.js b/exec/automsg.js
index 314801461a..af6a5057fa 100644
--- a/exec/automsg.js
+++ b/exec/automsg.js
@@ -21,6 +21,8 @@ if(!options)
 	options = {};
 if(!options.max_line_len)
 	options.max_line_len = 76;
+if(options.backup_level === undefined)
+	options.backup_level = 10;
 
 function automsg()
 {
@@ -63,8 +65,8 @@ function automsg()
 						if(!console.noyes(bbs.text(AnonymousQ)))
 							anon = true;
 					}
-					if(options.backup_level !== 0)
-						file_backup(automsg, options.backup_level);
+					if(typeof options.backup_level == "number")
+						file_backup(automsg, Number(options.backup_level));
 					var file = new File(automsg);
 					if(!file.open("w")) {
 						alert("Error " + file.error + " opening " + file.name);
-- 
GitLab