From f7fa0002661ff58b448ebf0321c7552f01fc6f79 Mon Sep 17 00:00:00 2001 From: TranRed Date: Sat, 24 Aug 2019 17:26:37 +0200 Subject: [PATCH] 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 --- src/widgets/dialogs/UserInfoPopup.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 527d24a44..36764cd31 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -30,7 +30,6 @@ #define TEXT_VIEWS "Views: " #define TEXT_CREATED "Created: " - namespace { const auto kBorderColor = QColor(255, 255, 255, 80); @@ -561,11 +560,15 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget() std::vector durationUnits = getSettings()->timeoutDurationUnits; - std::vector> t(8); // Timeouts. + std::vector> t(8); // Timeouts. auto i = 0; + std::generate(t.begin(), t.end(), [&] { - return std::make_pair(durationsPerUnit[i] + durationUnits[i], - calculateTimeoutDuration(durationsPerUnit[i], durationUnits[i++])); + std::pair pair = std::make_pair( + durationsPerUnit[i] + durationUnits[i], + calculateTimeoutDuration(durationsPerUnit[i], durationUnits[i])); + i++; + return pair; }); addTimeouts("Timeouts", t);