mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-25 16:41:04 +00:00
Make sure we don't access outside the choices_ array in PopupMultiChoice
This commit is contained in:
parent
f1b7580be8
commit
67183f5822
@ -205,7 +205,12 @@ UI::EventReturn PopupMultiChoice::HandleClick(UI::EventParams &e) {
|
||||
}
|
||||
|
||||
void PopupMultiChoice::UpdateText() {
|
||||
valueText_ = category_ ? category_->T(choices_[*value_ - minVal_]) : choices_[*value_ - minVal_];
|
||||
// Clamp the value to be safe.
|
||||
if (*value_ < minVal_ || *value_ > minVal_ + numChoices_ - 1) {
|
||||
valueText_ = "(invalid choice)"; // Shouldn't happen. Should be no need to translate this.
|
||||
} else {
|
||||
valueText_ = category_ ? category_->T(choices_[*value_ - minVal_]) : choices_[*value_ - minVal_];
|
||||
}
|
||||
}
|
||||
|
||||
void PopupMultiChoice::ChoiceCallback(int num) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user