diff --git a/src/providers/IvrApi.cpp b/src/providers/IvrApi.cpp index 4c042d718..3e5ac4dd3 100644 --- a/src/providers/IvrApi.cpp +++ b/src/providers/IvrApi.cpp @@ -37,8 +37,6 @@ void IvrApi::getBulkEmoteSets(QString emoteSetList, ResultCallback successCallback, IvrFailureCallback failureCallback) { - assert(!emoteSetList.isEmpty()); - QUrlQuery urlQuery; urlQuery.addQueryItem("set_id", emoteSetList); diff --git a/src/providers/twitch/TwitchAccount.cpp b/src/providers/twitch/TwitchAccount.cpp index e98707cc5..495b9502f 100644 --- a/src/providers/twitch/TwitchAccount.cpp +++ b/src/providers/twitch/TwitchAccount.cpp @@ -307,13 +307,16 @@ void TwitchAccount::loadUserstateEmotes(QStringList emoteSetKeys) constexpr int batchSize = 100; std::vector 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)); }