Skip to content

Commit

Permalink
PopupMultiChoice: Don't range-check the int-value if being initialize…
Browse files Browse the repository at this point in the history
…d from PopupMultiChoiceDynamic (valgrind)
  • Loading branch information
hrydgard committed Apr 27, 2023
1 parent 26d0128 commit 67aa951
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Common/UI/PopupScreens.h
Expand Up @@ -204,10 +204,12 @@ class PopupMultiChoice : public AbstractChoiceWithValueDisplay {
I18NCat category, ScreenManager *screenManager, UI::LayoutParams *layoutParams = nullptr)
: AbstractChoiceWithValueDisplay(text, layoutParams), value_(value), choices_(choices), minVal_(minVal), numChoices_(numChoices),
category_(category), screenManager_(screenManager) {
if (*value >= numChoices + minVal)
*value = numChoices + minVal - 1;
if (*value < minVal)
*value = minVal;
if (choices) {
if (*value >= numChoices + minVal)
*value = numChoices + minVal - 1;
if (*value < minVal)
*value = minVal;
}
OnClick.Handle(this, &PopupMultiChoice::HandleClick);
UpdateText();
}
Expand Down

0 comments on commit 67aa951

Please sign in to comment.