Only check for config menu if the plugin is linked and loaded

This commit is contained in:
Maschell 2024-08-04 15:41:10 +02:00
parent b34fa84bed
commit 9e0932cb38

View File

@ -84,6 +84,8 @@ void ConfigUtils::displayMenu() {
info.pluginData = plugin.getPluginDataCopy();
std::unique_ptr<WUPSConfigAPIBackend::WUPSConfig> config;
if (plugin.isLinkedAndLoaded()) {
if (const auto configData = plugin.getConfigData()) {
if (const auto configHandleOpt = configData->createConfig()) {
WUPSConfigAPIStatus callbackResult = configData->CallMenuOpenedCallback(configHandleOpt.value());
@ -106,7 +108,7 @@ void ConfigUtils::displayMenu() {
DEBUG_FUNCTION_LINE_ERR("Hook had invalid ptr");
break;
}
auto cur_config_handle = reinterpret_cast<void *(*) ()>(static_cast<uint32_t *>(hook.getFunctionPointer()))();
auto cur_config_handle = ((void *(*) ())((uint32_t *) hook.getFunctionPointer()))();
if (cur_config_handle == nullptr) {
DEBUG_FUNCTION_LINE_WARN("Hook returned empty handle");
break;
@ -119,6 +121,7 @@ void ConfigUtils::displayMenu() {
}
}
}
}
if (!config) {
config = make_unique_nothrow<WUPSConfigAPIBackend::WUPSConfig>(info.name);
}