fixed bug that terminates chatterino

seems like durationUnits[i++] tried to access a non existing element and chatterino crashed while opening the user card.

this tweek fixed it
This commit is contained in:
TranRed 2019-08-24 17:26:37 +02:00
parent 25871bdc2f
commit f7fa000266

View file

@ -30,7 +30,6 @@
#define TEXT_VIEWS "Views: " #define TEXT_VIEWS "Views: "
#define TEXT_CREATED "Created: " #define TEXT_CREATED "Created: "
namespace { namespace {
const auto kBorderColor = QColor(255, 255, 255, 80); const auto kBorderColor = QColor(255, 255, 255, 80);
@ -561,11 +560,15 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
std::vector<QString> durationUnits = getSettings()->timeoutDurationUnits; std::vector<QString> durationUnits = getSettings()->timeoutDurationUnits;
std::vector<std::pair<QString, int>> t(8); // Timeouts. std::vector<std::pair<QString, int>> t(8); // Timeouts.
auto i = 0; auto i = 0;
std::generate(t.begin(), t.end(), [&] { std::generate(t.begin(), t.end(), [&] {
return std::make_pair(durationsPerUnit[i] + durationUnits[i], std::pair<QString, int> pair = std::make_pair(
calculateTimeoutDuration(durationsPerUnit[i], durationUnits[i++])); durationsPerUnit[i] + durationUnits[i],
calculateTimeoutDuration(durationsPerUnit[i], durationUnits[i]));
i++;
return pair;
}); });
addTimeouts("Timeouts", t); addTimeouts("Timeouts", t);