Skip to content

Commit

Permalink
Fixed a crash introduced in 2f568b8 (#2856) (#2871)
Browse files Browse the repository at this point in the history
  • Loading branch information
zneix committed Jun 6, 2021
1 parent 2f568b8 commit 5512437
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/providers/IvrApi.cpp
Expand Up @@ -37,8 +37,6 @@ void IvrApi::getBulkEmoteSets(QString emoteSetList,
ResultCallback<QJsonArray> successCallback,
IvrFailureCallback failureCallback)
{
assert(!emoteSetList.isEmpty());

QUrlQuery urlQuery;
urlQuery.addQueryItem("set_id", emoteSetList);

Expand Down
9 changes: 6 additions & 3 deletions src/providers/twitch/TwitchAccount.cpp
Expand Up @@ -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));
}
Expand Down

0 comments on commit 5512437

Please sign in to comment.