From 2fab36cf49b66f5b31ece8a3dcff49691c1e315a Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Tue, 13 Aug 2024 11:13:34 +0200 Subject: [PATCH] snakeegg: Fix deserialize error --- src/variety/snakeegg.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/variety/snakeegg.js b/src/variety/snakeegg.js index 95d5832b0..8f465b8f6 100644 --- a/src/variety/snakeegg.js +++ b/src/variety/snakeegg.js @@ -258,12 +258,16 @@ BankPiece: { num: null, deserialize: function(str) { + if (typeof str === "string" && str[str.length - 1] === "=") { + str = str.substring(0, str.length - 1); + } + if (+str) { this.num = +str; } else if (!str) { this.num = -1; } else { - throw new Error("Invalid piece"); + throw new Error("Invalid piece: " + typeof str + " " + str); } }, serialize: function() {