Commit 42abd8b1 authored by Olivier Goffart's avatar Olivier Goffart
Browse files

QmlJS::Delta: fix crash if a document does not have a qmlProgram

parent d89f4770
......@@ -246,8 +246,11 @@ static QString _methodName(UiSourceElement *source)
Delta::DebugIdMap Delta::operator()(Document::Ptr doc1, Document::Ptr doc2, const DebugIdMap &debugIds)
Delta::DebugIdMap Delta::operator()(const Document::Ptr &doc1, const Document::Ptr &doc2, const DebugIdMap &debugIds)
{
Q_ASSERT(doc1->qmlProgram());
Q_ASSERT(doc2->qmlProgram());
QHash< UiObjectMember*, QList<QDeclarativeDebugObjectReference > > newDebuggIds;
Map M = Mapping(doc1, doc2);
......
......@@ -56,7 +56,7 @@ public:
public:
typedef QHash< UiObjectMember*, QList<QDeclarativeDebugObjectReference > > DebugIdMap;
DebugIdMap operator()(Document::Ptr doc1, Document::Ptr doc2, const DebugIdMap& debugIds);
DebugIdMap operator()(const QmlJS::Document::Ptr &doc1, const QmlJS::Document::Ptr &doc2, const DebugIdMap &debugIds);
QList<Change> changes() const;
......
......@@ -140,7 +140,7 @@ void QmlJSLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
if (!core->hasContext(dbgcontext))
return;
if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName()) {
if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName() && doc->qmlProgram() && m_previousDoc->qmlProgram()) {
if (m_debugIds.isEmpty())
m_debugIds = m_initialTable.value(doc->fileName());
Delta delta;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment