dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 8cd24c4c37a5b72a2225f1986281dd51287b4191
parent cdd287d57eee84a5368cf5eb2061e7dde4718f7f
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat,  6 Apr 2024 17:11:46 -0700

prevent chess analyze of empty games

Diffstat:
Mpkg/web/handlers/interceptors/chess.go | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/pkg/web/handlers/interceptors/chess.go b/pkg/web/handlers/interceptors/chess.go @@ -994,6 +994,10 @@ func AnalyzeGame(gg *ChessGame, pgn string, t int64) (out AnalyzeResult, err err positions := g.Positions() nbPosition := len(positions) + if nbPosition <= 1 { + return out, errors.New("no position to analyze") + } + pubProgress := func(step int) { progress := ChessAnalyzeProgress{Step: step, Total: nbPosition} gg.SetAnalyzeProgress(progress)