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: