summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-22 16:22:28 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-22 16:22:28 -0400
commitd2e98b3ad96f312c768cfbc3bf549a3b61d4542d (patch)
tree292750800da57de09bb2f9ebccfcdd4ac1cf545d
parent64369c50ffc24382c971fc731fe829ed71f74a51 (diff)
downloadBot-Zulip-Chess-d2e98b3ad96f312c768cfbc3bf549a3b61d4542d.tar.gz
Bot-Zulip-Chess-d2e98b3ad96f312c768cfbc3bf549a3b61d4542d.zip
don't fail if we load an ended game
-rw-r--r--lib/Bot/Zulip/Chess.pm4
1 files changed, 4 insertions, 0 deletions
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 $_;