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

This commit is contained in:
Olivier Goffart
2010-07-13 15:01:53 +02:00
parent d89f4770ca
commit 42abd8b15c
3 changed files with 6 additions and 3 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;