Commit 8ed2d952 authored by Alexander Semke's avatar Alexander Semke
Browse files

Avoid division by zero when calculation the number of moves to go in the

UCI protocol with time control activated.

BUG: 446409
FIXED-IN: 21.12.1
parent 39ed70b1
Pipeline #105574 passed with stage
in 1 minute and 19 seconds
......@@ -142,9 +142,11 @@ void UciProtocol::requestNextMove() {
goString += QLatin1String(" binc ") + QString::number ( binc * 1000 );
int moves = Manager::self()->timeControl ( NoColor ).moves;
int movesToGo = mMoveHistory.size() % moves;
if ( movesToGo > 0 )
goString += QLatin1String(" movestogo ") + QString::number ( movesToGo );
if (moves > 0) {
int movesToGo = mMoveHistory.size() % moves;
if ( movesToGo > 0 )
goString += QLatin1String(" movestogo ") + QString::number ( movesToGo );
}
}
write ( goString );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment