diff --git a/xtrn/lord2/l2lib.js b/xtrn/lord2/l2lib.js
index 4f67e021b3750d5a127398e11282b2f7ec38d31a..7b95092108ddca741f5f838ef60b52caa3683e0e 100644
--- a/xtrn/lord2/l2lib.js
+++ b/xtrn/lord2/l2lib.js
@@ -548,7 +548,7 @@ function getkey()
 	ch = '\x00';
 	do {
 		ch = getkeyw();
-		if (ch === null || ch.length < 1) {
+		if (ch === undefined || ch === null || ch.length < 1) {
 			ch = '\x00';
 		}
 	} while (ch === '\x00');