From 5d9ffefeae7e8e12d1c8766d2f35b0bdce662a0c Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Thu, 26 Sep 2019 02:13:14 +0000
Subject: [PATCH] Fix fencepost error, and ignore updates for players that
 arent in the trader.dat file.

---
 xtrn/lord2/lord2.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xtrn/lord2/lord2.js b/xtrn/lord2/lord2.js
index b356c7683e..d2df513a9a 100644
--- a/xtrn/lord2/lord2.js
+++ b/xtrn/lord2/lord2.js
@@ -3003,8 +3003,10 @@ function update(skip) {
 		for (i = 0; i < ufile.length; i++) {
 			if (i === player.Record)
 				continue;
-			if (i > players.length) {
+			if (i >= players.length) {
 				op = pfile.get(i);
+				if (op === null)
+					break;
 				players.push({x:op.x, y:op.y, map:op.map, onnow:op.onnow, busy:op.busy, battle:op.battle, deleted:op.deleted});
 			}
 			if (players[i].deleted)
-- 
GitLab