mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Avoid ASSERT from emulated driver
* not all plugins are installed * use default simulator if there is no simulator info
This commit is contained in:
@@ -447,7 +447,20 @@ namespace BlackCore
|
||||
this->setRemoteAircraftProvider(renderedAircraftProvider);
|
||||
|
||||
// use simulator info from ISimulator as it can access the emulated driver settings
|
||||
const CSimulatorInfo simInfo = simulator->getSimulatorInfo();
|
||||
CSimulatorInfo simInfo = simulator->getSimulatorInfo();
|
||||
if (!simInfo.isSingleSimulator())
|
||||
{
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "Invalid simulator from plugin");
|
||||
simInfo = CSimulatorInfo::p3d();
|
||||
if (simulator->isEmulatedDriver())
|
||||
{
|
||||
CLogMessage(this).error(u"Emulated driver does NOT provide valid simulator, using default '%1', plugin: '%2'") << simInfo.toQString(true) << simulatorPluginInfo.toQString(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error(u"Invalid driver using default '%1', plugin: '%2'") << simInfo.toQString(true) << simulatorPluginInfo.toQString(true);
|
||||
}
|
||||
}
|
||||
Q_ASSERT_X(simInfo.isSingleSimulator(), Q_FUNC_INFO, "need single simulator");
|
||||
|
||||
m_modelSetSimulator.set(simInfo);
|
||||
|
||||
@@ -384,7 +384,11 @@ namespace BlackSimPlugin
|
||||
}
|
||||
else
|
||||
{
|
||||
// not all drivers are installed
|
||||
CLogMessage(this).validationError(u"No valid plugin for '%1'") << simulator.toQString();
|
||||
const QString sn = simulator.toQString(true);
|
||||
const CSimulatorPluginInfo faked = CSimulatorPluginInfo(simulator.toPluginIdentifier(), sn, sn, QStringLiteral("Emulated, but uninstalled '%1'").arg(sn), false);
|
||||
this->setNewPluginInfo(faked, settings.getDefaultModel());
|
||||
}
|
||||
|
||||
// update provider, own name, title
|
||||
|
||||
Reference in New Issue
Block a user