diff options
Diffstat (limited to 'framework/source/services/modulemanager.cxx')
-rw-r--r-- | framework/source/services/modulemanager.cxx | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx index c03bf2611ecd..f2e5758b90e1 100644 --- a/framework/source/services/modulemanager.cxx +++ b/framework/source/services/modulemanager.cxx @@ -36,6 +36,8 @@ #include <comphelper/sequenceashashmap.hxx> #include <comphelper/sequence.hxx> #include <comphelper/enumhelper.hxx> +#include <comphelper/configuration.hxx> +#include <utility> namespace { @@ -60,7 +62,7 @@ private: public: - explicit ModuleManager(const css::uno::Reference< css::uno::XComponentContext >& xContext); + explicit ModuleManager(css::uno::Reference< css::uno::XComponentContext > xContext); ModuleManager(const ModuleManager&) = delete; ModuleManager& operator=(const ModuleManager&) = delete; @@ -123,13 +125,16 @@ private: OUString implts_identify(const css::uno::Reference< css::uno::XInterface >& xComponent); }; -ModuleManager::ModuleManager(const css::uno::Reference< css::uno::XComponentContext >& xContext) - : m_xContext(xContext) +ModuleManager::ModuleManager(css::uno::Reference< css::uno::XComponentContext > xContext) + : m_xContext(std::move(xContext)) { - m_xCFG.set( comphelper::ConfigurationHelper::openConfig( - m_xContext, "/org.openoffice.Setup/Office/Factories", - comphelper::EConfigurationModes::ReadOnly ), - css::uno::UNO_QUERY_THROW ); + if (!comphelper::IsFuzzing()) + { + m_xCFG.set( comphelper::ConfigurationHelper::openConfig( + m_xContext, "/org.openoffice.Setup/Office/Factories", + comphelper::EConfigurationModes::ReadOnly ), + css::uno::UNO_QUERY_THROW ); + } } OUString ModuleManager::getImplementationName() @@ -233,7 +238,7 @@ void SAL_CALL ModuleManager::replaceByName(const OUString& sName , { // let "NoSuchElementException" out ! We support the same API ... // and without a flush() at the end all changed data before will be ignored ! - xModule->replaceByName(prop.first, prop.second); + xModule->replaceByName(prop.first.maString, prop.second); } ::comphelper::ConfigurationHelper::flush(xCfg); @@ -243,7 +248,8 @@ css::uno::Any SAL_CALL ModuleManager::getByName(const OUString& sName) { // get access to the element css::uno::Reference< css::container::XNameAccess > xModule; - m_xCFG->getByName(sName) >>= xModule; + if (m_xCFG) + m_xCFG->getByName(sName) >>= xModule; if (!xModule.is()) { throw css::uno::RuntimeException( @@ -261,17 +267,17 @@ css::uno::Any SAL_CALL ModuleManager::getByName(const OUString& sName) lProps[sPropName] = xModule->getByName(sPropName); } - return css::uno::makeAny(lProps.getAsConstPropertyValueList()); + return css::uno::Any(lProps.getAsConstPropertyValueList()); } css::uno::Sequence< OUString > SAL_CALL ModuleManager::getElementNames() { - return m_xCFG->getElementNames(); + return m_xCFG ? m_xCFG->getElementNames() : css::uno::Sequence<OUString>(); } sal_Bool SAL_CALL ModuleManager::hasByName(const OUString& sName) { - return m_xCFG->hasByName(sName); + return m_xCFG && m_xCFG->hasByName(sName); } css::uno::Type SAL_CALL ModuleManager::getElementType() @@ -281,7 +287,7 @@ css::uno::Type SAL_CALL ModuleManager::getElementType() sal_Bool SAL_CALL ModuleManager::hasElements() { - return m_xCFG->hasElements(); + return m_xCFG && m_xCFG->hasElements(); } css::uno::Reference< css::container::XEnumeration > SAL_CALL ModuleManager::createSubSetEnumerationByQuery(const OUString&) @@ -301,7 +307,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL ModuleManager::crea { ::comphelper::SequenceAsHashMap lModuleProps = getByName(rModuleName); if (lModuleProps.match(lSearchProps)) - lResult.push_back(css::uno::makeAny(lModuleProps.getAsConstPropertyValueList())); + lResult.push_back(css::uno::Any(lModuleProps.getAsConstPropertyValueList())); } catch(const css::uno::Exception&) { |