QmlProfiler: Don't crash if there is no QmlJSModelManager

Change-Id: I63b978f0f9c42c8968da7e779cdff876c18d8f31
Task-number: QTCREATORBUG-16276
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2016-05-17 10:42:57 +02:00
parent f0dcda8592
commit 070897091a

View File

@@ -150,11 +150,17 @@ void QmlProfilerDetailsRewriter::requestDetailsForLocation(int requestId,
void QmlProfilerDetailsRewriter::reloadDocuments() void QmlProfilerDetailsRewriter::reloadDocuments()
{ {
if (!d->m_pendingDocs.isEmpty()) if (!d->m_pendingDocs.isEmpty()) {
QmlJS::ModelManagerInterface::instance()->updateSourceFiles(d->m_pendingDocs, false); if (QmlJS::ModelManagerInterface *manager = QmlJS::ModelManagerInterface::instance()) {
else manager->updateSourceFiles(d->m_pendingDocs, false);
} else {
d->m_pendingDocs.clear();
emit eventDetailsChanged(); emit eventDetailsChanged();
} }
} else {
emit eventDetailsChanged();
}
}
void QmlProfilerDetailsRewriter::rewriteDetailsForLocation(QTextStream &textDoc, void QmlProfilerDetailsRewriter::rewriteDetailsForLocation(QTextStream &textDoc,
QmlJS::Document::Ptr doc, int requestId, const QmlEventLocation &location) QmlJS::Document::Ptr doc, int requestId, const QmlEventLocation &location)