if to clamp
This commit is contained in:
parent
5a14af5f38
commit
60d1822206
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include "citra_qt/configuration/config.h"
|
#include "citra_qt/configuration/config.h"
|
||||||
|
@ -102,15 +103,15 @@ void Config::ReadValues() {
|
||||||
|
|
||||||
qt_config->endArray();
|
qt_config->endArray();
|
||||||
|
|
||||||
if (Settings::values.current_input_profile_index <= num_input_profiles) {
|
|
||||||
Settings::values.current_input_profile_index = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a input profile if no input profiles exist, with the default or old settings
|
// create a input profile if no input profiles exist, with the default or old settings
|
||||||
if (num_input_profiles == 0) {
|
if (num_input_profiles == 0) {
|
||||||
append_profile();
|
append_profile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ensure that the current input profile index is valid.
|
||||||
|
Settings::values.current_input_profile_index =
|
||||||
|
std::clamp(Settings::values.current_input_profile_index, 0, num_input_profiles - 1);
|
||||||
|
|
||||||
Settings::LoadProfile(Settings::values.current_input_profile_index);
|
Settings::LoadProfile(Settings::values.current_input_profile_index);
|
||||||
|
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
|
|
Loading…
Reference in New Issue