Commit f4959b0f authored by Laurent Montel's avatar Laurent Montel 😁

Fix potential crash

parent 988e2881
......@@ -123,8 +123,11 @@ bool PluginEditorManagerPrivate::initializePlugins()
void PluginEditorManagerPrivate::loadPlugin(PluginEditorInfo *item)
{
item->plugin = KPluginLoader(item->metaData.fileName()).factory()->create<PluginEditor>(q, QVariantList() << item->saveName());
item->plugin->setOrder(item->order);
KPluginLoader pluginLoader(item->metaData.fileName());
if (pluginLoader.factory()) {
item->plugin = pluginLoader.factory()->create<PluginEditor>(q, QVariantList() << item->saveName());
item->plugin->setOrder(item->order);
}
}
QVector<PluginEditor *> PluginEditorManagerPrivate::pluginsList() const
......
......@@ -115,7 +115,10 @@ bool PluginEditorCheckBeforeSendManagerPrivate::initializePlugins()
void PluginEditorCheckBeforeSendManagerPrivate::loadPlugin(PluginEditorCheckBeforeSendInfo *item)
{
item->plugin = KPluginLoader(item->metaData.fileName()).factory()->create<PluginEditorCheckBeforeSend>(q, QVariantList() << item->saveName());
KPluginLoader pluginLoader(item->metaData.fileName());
if (pluginLoader.factory()) {
item->plugin = pluginLoader.factory()->create<PluginEditorCheckBeforeSend>(q, QVariantList() << item->saveName());
}
}
QVector<PluginEditorCheckBeforeSend *> PluginEditorCheckBeforeSendManagerPrivate::pluginsList() const
......
......@@ -148,7 +148,10 @@ QVector<MessageViewer::HeaderStylePlugin *> HeaderStylePluginManagerPrivate::plu
void HeaderStylePluginManagerPrivate::loadPlugin(HeaderStylePluginInfo *item)
{
item->plugin = KPluginLoader(item->metaData.fileName()).factory()->create<MessageViewer::HeaderStylePlugin>(q, QVariantList() << item->saveName());
KPluginLoader pluginLoader(item->metaData.fileName());
if (pluginLoader.factory()) {
item->plugin = pluginLoader.factory()->create<MessageViewer::HeaderStylePlugin>(q, QVariantList() << item->saveName());
}
}
HeaderStylePluginManager *HeaderStylePluginManager::self()
......
......@@ -138,7 +138,10 @@ bool ViewerPluginManagerPrivate::initializePluginList()
void ViewerPluginManagerPrivate::loadPlugin(ViewerPluginInfo *item)
{
item->plugin = KPluginLoader(item->metaData.fileName()).factory()->create<MessageViewer::ViewerPlugin>(q, QVariantList() << item->saveName());
KPluginLoader pluginLoader(item->metaData.fileName());
if (pluginLoader.factory()) {
item->plugin = pluginLoader.factory()->create<MessageViewer::ViewerPlugin>(q, QVariantList() << item->saveName());
}
}
QVector<ViewerPlugin *> ViewerPluginManagerPrivate::pluginsList() const
......
......@@ -139,7 +139,10 @@ QVector<WebEngineViewer::NetworkPluginUrlInterceptor *> NetworkUrlInterceptorPlu
void NetworkUrlInterceptorPluginManagerPrivate::loadPlugin(MailNetworkUrlInterceptorPluginInfo *item)
{
item->plugin = KPluginLoader(item->metaData.fileName()).factory()->create<WebEngineViewer::NetworkPluginUrlInterceptor>(q, QVariantList() << item->saveName());
KPluginLoader pluginLoader(item->metaData.fileName());
if (pluginLoader.factory()) {
item->plugin = pluginLoader.factory()->create<WebEngineViewer::NetworkPluginUrlInterceptor>(q, QVariantList() << item->saveName());
}
}
NetworkUrlInterceptorPluginManager *NetworkUrlInterceptorPluginManager::self()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment