mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
Don't assert if CPluginManagerSimulator::createListener returns nullptr
CPluginManagerSimulator::createListener returns nullptr if no listener could be created, e.g. because the plugin could not be loaded due to missing dependencies. Handle this scenario properly instead of raising an assert. refs #669
This commit is contained in:
@@ -419,7 +419,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
ISimulatorListener *listener = m_plugins->createListener(simulatorInfo.getIdentifier());
|
||||
Q_ASSERT_X(listener, Q_FUNC_INFO, "No listener");
|
||||
if (!listener) { return; }
|
||||
|
||||
if (listener->thread() != &m_listenersThread)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "blackcore/pluginmanagersimulator.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
@@ -42,9 +43,10 @@ namespace BlackCore
|
||||
PluginExtended &plugin = m_plugins[pluginId];
|
||||
if (!plugin.listener)
|
||||
{
|
||||
ISimulatorFactory *factory = getPluginById<ISimulatorFactory>(pluginId);
|
||||
ISimulatorFactory *factory = getFactory(pluginId);
|
||||
if (!factory)
|
||||
{
|
||||
CLogMessage(this).warning("Could not load plugin %1.") << pluginId;
|
||||
m_plugins.remove(pluginId);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace BlackCore
|
||||
|
||||
//! Create simulator listener from the plugin
|
||||
//! In case one is existing already, it is returned instead.
|
||||
//! Returns nullptr if no listener could be created.
|
||||
ISimulatorListener *createListener(const QString &pluginId);
|
||||
|
||||
//! Get previously created simulator listener from the plugin
|
||||
|
||||
Reference in New Issue
Block a user