From 1b0458d27bd251368b5775842681fdf5ab9bc07b Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 11 Sep 2018 07:28:49 +0000
Subject: [PATCH] Fix puke on empty data/user/####.ini file: !JavaScript 
 avatars.js line 340: TypeError: avatar is null Added a couple of comments and
 some helpful log/console output.

---
 exec/avatars.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/exec/avatars.js b/exec/avatars.js
index 6ef66f81a0..25bc8b9393 100644
--- a/exec/avatars.js
+++ b/exec/avatars.js
@@ -337,6 +337,8 @@ function export_users(msgbase, realnames, all)
 			continue;
 		}
 		var avatar = lib.read_localuser(n);
+		if(!avatar)
+			continue;
 		if(avatar.export_count == undefined)
 			avatar.export_count = 0;
 		var last_exported = 0;
@@ -493,7 +495,7 @@ function install()
 				"node_num": 1,
 				"settings": 0,
 				"startup_dir": "",
-				"freq": 30,
+				"freq": 30,		// interval
 				"mdays": 0,
 				"months": 0
 				});
@@ -510,7 +512,7 @@ function install()
 				"node_num": 1,
 				"settings": 0,
 				"startup_dir": "",
-				"freq": 30,
+				"freq": 1440,	// interval (once a day)
 				"mdays": 0,
 				"months": 0
 				});
@@ -671,7 +673,7 @@ function main()
 					var share_files = directory(filespec);
 					for(var i in share_files) {
 						if(share_files[i].search(EXCLUDE_FILES) >= 0) {
-							printf("Excluding file: %s\r\n", file_getname(share_files[i]));
+							log(LOG_DEBUG, format("Excluding file: %s", file_getname(share_files[i])));
 							continue;
 						}
 						printf("Exporting: %s\r\n", file_getname(share_files[i]));
-- 
GitLab