Fixed a crash introduced in 2f568b8 (#2856) (#2871)

This commit is contained in:
Paweł 2021-06-06 21:59:53 +02:00 committed by GitHub
parent 2f568b88ae
commit 5512437f1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -37,8 +37,6 @@ void IvrApi::getBulkEmoteSets(QString emoteSetList,
ResultCallback<QJsonArray> successCallback,
IvrFailureCallback failureCallback)
{
assert(!emoteSetList.isEmpty());
QUrlQuery urlQuery;
urlQuery.addQueryItem("set_id", emoteSetList);

View file

@ -307,13 +307,16 @@ void TwitchAccount::loadUserstateEmotes(QStringList emoteSetKeys)
constexpr int batchSize = 100;
std::vector<QStringList> batches;
int batchCount = (newEmoteSetKeys.size() / batchSize) + 1;
batches.reserve((newEmoteSetKeys.size() + 1) / batchSize);
batches.reserve(batchCount);
for (int i = 0; i < newEmoteSetKeys.size(); i += batchSize)
for (int i = 0; i < batchCount; i++)
{
QStringList batch;
for (int j = batchSize * i; j < batchSize; j++)
int last = std::min(batchSize, newEmoteSetKeys.size() - batchSize * i);
for (int j = batchSize * i; j < last; j++)
{
batch.push_back(newEmoteSetKeys.at(j));
}