Skip to content

Commit

Permalink
snakeegg: Fix deserialize error
Browse files Browse the repository at this point in the history
  • Loading branch information
x-sheep committed Aug 13, 2024
1 parent af68911 commit 2fab36c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/variety/snakeegg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 2fab36c

Please sign in to comment.