From 646107d2a5403e8db17707e74af94f64a0529eaf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Fri, 26 Mar 2021 17:36:47 -0400
Subject: [PATCH] Fix a (harmless) user creation error

When a players map is set, it automatically triggers a player record
write.  When a new player is being created, the map is set before
the player is added via @addchar.

This attempted to write record number undefined in the player file,
which threw an exception.  Since exceptions are being caught, logged,
and ignored, this did not cause a problem, but did log an error when
it wasn't necessary.
---
 xtrn/lord2/l2lib.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xtrn/lord2/l2lib.js b/xtrn/lord2/l2lib.js
index 89707a1264..8f6ad2789c 100644
--- a/xtrn/lord2/l2lib.js
+++ b/xtrn/lord2/l2lib.js
@@ -40,8 +40,10 @@ function savetime()
 
 function player_put()
 {
-	player.lastsaved = savetime();
-	player.put();
+	if (player.Record !== undefined) {
+		player.lastsaved = savetime();
+		player.put();
+	}
 }
 
 var Player_Def = [
-- 
GitLab