From a0faa0b7799c307761de06176f71d379f3788a67 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Mon, 15 Jan 2024 15:59:23 +0900 Subject: [PATCH] add warning if getmodulename is incorrect --- .../Core/src/sofa/simulation/RequiredPlugin.cpp | 9 ++++++++- .../plugins/SensableEmulation/initSensableEmulation.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/RequiredPlugin.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/RequiredPlugin.cpp index 90902b3a5b80..5a5f6b8555eb 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/RequiredPlugin.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/RequiredPlugin.cpp @@ -127,7 +127,14 @@ bool RequiredPlugin::loadPlugin() // Register Objects explicitely // Here we only have access to the path, so we need to find the Plugin from it const auto* plugin = pluginManager.getPluginByName(name); - sofa::core::ObjectFactory::getInstance()->registerObjectsFromPlugin(*plugin); + if (plugin) // can be nullptr if getModuleName is not (or badly) set + { + sofa::core::ObjectFactory::getInstance()->registerObjectsFromPlugin(*plugin); + } + else + { + msg_error() << "Could not register objects for " << name << "; check if getModuleName matches the given name."; + } if (d_stopAfterFirstSuffixFound.getValue()) break; } } diff --git a/applications/plugins/SensableEmulation/initSensableEmulation.cpp b/applications/plugins/SensableEmulation/initSensableEmulation.cpp index 6498101840df..1c218b3ab772 100644 --- a/applications/plugins/SensableEmulation/initSensableEmulation.cpp +++ b/applications/plugins/SensableEmulation/initSensableEmulation.cpp @@ -49,7 +49,7 @@ void initExternalModule() const char* getModuleName() { - return "Plugin Sensable Emulation"; + return "SensableEmulation"; } const char* getModuleVersion()