mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-06 05:43:47 +08:00
made sure that a quote is always found if all length is selected, otherwise showing that no quote was found for that length
This commit is contained in:
parent
36c7fce4e2
commit
fb6484b5ff
1 changed files with 11 additions and 0 deletions
|
@ -471,6 +471,9 @@ async function initWords() {
|
|||
success: function (data) {
|
||||
hideBackgroundLoader();
|
||||
try {
|
||||
if (data.quotes.length === 0) {
|
||||
throw new Error("No quotes");
|
||||
}
|
||||
quotes = data;
|
||||
quotes.groups.forEach((qg, i) => {
|
||||
let lower = qg[0];
|
||||
|
@ -643,6 +646,14 @@ async function initWords() {
|
|||
|
||||
if (config.quoteLength === -1) {
|
||||
group = Math.floor(Math.random() * quotes.groups.length);
|
||||
while (quotes.groups[group].length === 0) {
|
||||
group = Math.floor(Math.random() * quotes.groups.length);
|
||||
}
|
||||
} else {
|
||||
if (quotes.groups[group].length === 0) {
|
||||
Notifications.add("No quotes found for selected quote length", 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let rq =
|
||||
|
|
Loading…
Reference in a new issue