summaryrefslogtreecommitdiff
path: root/src/plugins/qmljsinspector
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-07-13 15:01:53 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-07-14 15:30:54 +0200
commit42abd8b15c22f7c808f33b275b06f333d6794553 (patch)
treefc652543a05e85cf3902c6b1a020ef7cb0510ae5 /src/plugins/qmljsinspector
parentd89f4770cadce763c233e8940fa9143276ba8893 (diff)
downloadqt-creator-42abd8b15c22f7c808f33b275b06f333d6794553.tar.gz
QmlJS::Delta: fix crash if a document does not have a qmlProgram
Diffstat (limited to 'src/plugins/qmljsinspector')
-rw-r--r--src/plugins/qmljsinspector/qmljsdelta.cpp5
-rw-r--r--src/plugins/qmljsinspector/qmljsdelta.h2
-rw-r--r--src/plugins/qmljsinspector/qmljslivetextpreview.cpp2
3 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/qmljsinspector/qmljsdelta.cpp b/src/plugins/qmljsinspector/qmljsdelta.cpp
index 491571cd3d..aa9d86827f 100644
--- a/src/plugins/qmljsinspector/qmljsdelta.cpp
+++ b/src/plugins/qmljsinspector/qmljsdelta.cpp
@@ -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);
diff --git a/src/plugins/qmljsinspector/qmljsdelta.h b/src/plugins/qmljsinspector/qmljsdelta.h
index 30f06fce93..38d9922378 100644
--- a/src/plugins/qmljsinspector/qmljsdelta.h
+++ b/src/plugins/qmljsinspector/qmljsdelta.h
@@ -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;
diff --git a/src/plugins/qmljsinspector/qmljslivetextpreview.cpp b/src/plugins/qmljsinspector/qmljslivetextpreview.cpp
index b43bdf6946..2adcc39e7b 100644
--- a/src/plugins/qmljsinspector/qmljslivetextpreview.cpp
+++ b/src/plugins/qmljsinspector/qmljslivetextpreview.cpp
@@ -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;