forked from qt-creator/qt-creator
qmldesigner: Avoid crash of TextToModelMerger::getQMLSingletons()
When m_scopeChain is invalid (due to an invalid ui file) getQMLSingletons would trigger a crash. Catch this case and return early (an error message would then be displayed). Fixes: QTCREATORBUG-24587 Change-Id: I80c70d8e7f1c88b14c53d3daebf957dc1e6089ee Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -2179,6 +2179,9 @@ QSet<QPair<QString, QString> > TextToModelMerger::qrcMapping() const
|
||||
QList<QmlTypeData> TextToModelMerger::getQMLSingletons() const
|
||||
{
|
||||
QList<QmlTypeData> list;
|
||||
if (!m_scopeChain || !m_scopeChain->document())
|
||||
return list;
|
||||
|
||||
const QmlJS::Imports *imports = m_scopeChain->context()->imports(
|
||||
m_scopeChain->document().data());
|
||||
|
||||
|
Reference in New Issue
Block a user