Fix possible crash in dictionaries download.

Fixes #17258.
This commit is contained in:
John Preston 2022-01-05 01:03:38 +03:00
parent cb8f86bc8d
commit fe7b120003
1 changed files with 3 additions and 3 deletions

View File

@ -139,6 +139,9 @@ void DownloadDictionaryInBackground(
not_null<Main::Session*> session, not_null<Main::Session*> session,
int counter, int counter,
std::vector<int> langs) { std::vector<int> langs) {
if (counter >= langs.size()) {
return;
}
const auto id = langs[counter]; const auto id = langs[counter];
counter++; counter++;
const auto destroyer = [=] { const auto destroyer = [=] {
@ -154,9 +157,6 @@ void DownloadDictionaryInBackground(
} }
} }
if (counter >= langs.size()) {
return;
}
DownloadDictionaryInBackground(session, counter, langs); DownloadDictionaryInBackground(session, counter, langs);
}; };
if (DictionaryExists(id)) { if (DictionaryExists(id)) {