Skip to content

Commit

Permalink
fix infinite recursion on getting opening name
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoBSalgueiro committed Oct 2, 2023
1 parent 3ba55fc commit b143b8f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/chess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export async function getOpening(
}
return invoke<string>("get_opening_from_fen", { fen: tree.fen })
.then((v) => v)
.catch(() => getOpening(root, position.slice(0, -1)));
.catch(() => position.length === 0 ? "" : getOpening(root, position.slice(0, -1)));
}

export function swapMove(fen: string, color?: Color) {
Expand Down

0 comments on commit b143b8f

Please sign in to comment.