From d2e98b3ad96f312c768cfbc3bf549a3b61d4542d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 22 Oct 2014 16:22:28 -0400 Subject: don't fail if we load an ended game --- lib/Bot/Zulip/Chess.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Bot/Zulip/Chess.pm b/lib/Bot/Zulip/Chess.pm index 1c9ddc9..321e393 100644 --- a/lib/Bot/Zulip/Chess.pm +++ b/lib/Bot/Zulip/Chess.pm @@ -94,6 +94,10 @@ has _chessboard => ( $board->go_move($white) if $white; $board->go_move($black) if $black; } + my $status = $board->status; + if ($status->{mate} || $status->{stalemate}) { + die "Game is over"; + } } catch { warn $_; -- cgit v1.2.3