Ref T663, avoid ASSERT when simulator is NO single simulator in mapping tool

This commit is contained in:
Klaus Basan
2019-05-18 17:48:23 +02:00
parent 8c1e10824c
commit 9cd0d5554c
2 changed files with 24 additions and 4 deletions

View File

@@ -121,8 +121,18 @@ namespace BlackGui
void CDbOwnModelSetFormDialog::setSimulator(const CSimulatorInfo &simulator)
{
Q_ASSERT_X(m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
m_simulatorInfo = simulator;
// Ref T663, avoid ASSERT in some weird cases
if (simulator.isSingleSimulator())
{
m_simulatorInfo = simulator;
}
else
{
const CSimulatorInfo resetSim = m_simulatorInfo.isSingleSimulator() ? m_simulatorInfo : CSimulatorInfo::guessDefaultSimulator();
const QString msg = QStringLiteral("Set invalid simulator, continue to use '%1'").arg(resetSim.toQString(true));
this->showMappingComponentOverlayHtmlMessage(msg);
m_simulatorInfo = resetSim;
}
ui->form_OwnModelSet->setSimulator(m_simulatorInfo);
this->setWindowTitle("Create model set for " + m_simulatorInfo.toQString(true));
}

View File

@@ -187,8 +187,18 @@ namespace BlackGui
void COwnModelSetForm::setSimulator(const CSimulatorInfo &simulator)
{
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
m_simulator = simulator;
// Ref T663, avoid ASSERT in some weird cases
if (simulator.isSingleSimulator())
{
m_simulator = simulator;
}
else
{
const CSimulatorInfo resetSim = m_simulator.isSingleSimulator() ? m_simulator : CSimulatorInfo::guessDefaultSimulator();
const QString msg = QStringLiteral("Set invalid simulator, continue to use '%1'").arg(resetSim.toQString(true));
this->showOverlayHTMLMessage(msg);
m_simulator = resetSim;
}
}
bool COwnModelSetForm::hasDistributorPreferences() const