From a13d8434552acfa612ef93fb6c069e5aa3d6cbb3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Thu, 4 Mar 2021 01:57:49 -0500
Subject: [PATCH] Fix an error on timeout handling and fix issue dropping quest
 items.

---
 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 f808f8f31e..8eea5ed7f6 100644
--- a/xtrn/lord2/lord2.js
+++ b/xtrn/lord2/lord2.js
@@ -48,7 +48,7 @@ function handle_timeout(reason)
 			run_ref('notime', 'help.ref');
 			break;
 	}
-	run_ref('endgame', 'gameref.ref');
+	run_ref('endgame', 'gametxt.ref');
 	exit(0);
 }
 time_callback = handle_timeout;
@@ -2363,6 +2363,8 @@ rescan:
 			return;
 		}
 		else {
+			if (cur >= inv.length)
+				cur = inv.length - 1;
 newpage:
 			while (1) {
 				choice = items_menu(inv, cur, false, false, 'D', y, 22);
-- 
GitLab