aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bot.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bot.cpp b/src/bot.cpp
index 0f8d12a..a1b4fb2 100644
--- a/src/bot.cpp
+++ b/src/bot.cpp
@@ -119,6 +119,9 @@ int ScoreMove(const Game *board, const Move &move) {
std::vector<Move> GetSortedLegalMoves(Game *g) {
auto moves = GetLegalMoves(g);
+ if (moves.size() == 0) {
+ return moves;
+ }
std::sort(moves.begin(), moves.end(), [&](const Move &a, const Move &c) {
return ScoreMove(g, a) > ScoreMove(g, c);
});