From 2ec1f04d26480752cd60253dd72a7924ff582168 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sun, 29 Sep 2024 22:02:24 -0500 Subject: [PATCH] only load a profile if profileNum exists and is enabled (#1167) only load a profile if it profileNum exists and is enabled --- src/storagemanager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/storagemanager.cpp b/src/storagemanager.cpp index dfc61718c..c8d2121fe 100644 --- a/src/storagemanager.cpp +++ b/src/storagemanager.cpp @@ -162,8 +162,12 @@ char* Storage::currentProfileLabel() { void Storage::setFunctionalPinMappings() { GpioMappingInfo* alts = nullptr; - if (config.gamepadOptions.profileNumber >= 2 && config.gamepadOptions.profileNumber <= 4) - alts = this->config.profileOptions.gpioMappingsSets[config.gamepadOptions.profileNumber-2].pins; + if (config.gamepadOptions.profileNumber >= 2 && + config.gamepadOptions.profileNumber <= config.profileOptions.gpioMappingsSets_count + 1) { + if (config.profileOptions.gpioMappingsSets[config.gamepadOptions.profileNumber-2].enabled) { + alts = config.profileOptions.gpioMappingsSets[config.gamepadOptions.profileNumber-2].pins; + } + } for (Pin_t pin = 0; pin < (Pin_t)NUM_BANK0_GPIOS; pin++) { // assign the functional pin to the profile pin if: