Skip to content
Snippets Groups Projects
Commit b86af518 authored by Franck Dary's avatar Franck Dary
Browse files

Corrected bug where wordIndex would overflow

parent f6b644a8
No related branches found
No related tags found
No related merge requests found
......@@ -448,15 +448,15 @@ bool Config::moveWordIndex(int relativeMovement)
dir = -1;
int movementDone = 0;
if (isMultiwordPredicted(wordIndex))
if (isMultiwordPredicted(wordIndex) and (dir >= 0 or wordIndex > 0))
wordIndex += dir;
while (movementDone != relativeMovement)
{
if (isMultiwordPredicted(wordIndex))
if (isMultiwordPredicted(wordIndex) and (dir >= 0 or wordIndex > 0))
wordIndex += dir;
wordIndex += dir;
movementDone += dir;
if (isMultiwordPredicted(wordIndex))
if (isMultiwordPredicted(wordIndex) and (dir >= 0 or wordIndex > 0))
wordIndex += dir;
}
......@@ -468,7 +468,7 @@ void Config::moveWordIndexRelaxed(int relativeMovement)
int dir = 1;
if (relativeMovement < 0)
dir = -1;
if (isMultiwordPredicted(wordIndex))
if (isMultiwordPredicted(wordIndex) and (dir >= 0 or wordIndex > 0))
wordIndex += dir;
for (int i = 0; i < abs(relativeMovement); i++)
if (!moveWordIndex(dir))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment