mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-23 00:37:29 +08:00
added code to stop infinite loop
This commit is contained in:
parent
33823cfa30
commit
aaef8f7f5f
|
@ -1150,12 +1150,15 @@ export async function addWord() {
|
|||
} else if (Config.mode === "quote") {
|
||||
randomWord = randomQuote.textSplit[words.length];
|
||||
} else {
|
||||
let regenarationCount = 0; //infinite loop emergency stop button
|
||||
while (
|
||||
regenarationCount < 100 &&
|
||||
previousWordStripped == randomWord ||
|
||||
previousWord2Stripped == randomWord ||
|
||||
randomWord.indexOf(" ") > -1 ||
|
||||
(!Config.punctuation && randomWord == "I")
|
||||
) {
|
||||
regenarationCount++;
|
||||
randomWord = wordset.randomWord();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue