Commit b47b9ea9 authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Nikolai Kosjar

QML: Band-aid fix to prevent a crash

If the document that FindExportedCppTypes is to search is not in the
snapshot, skip over it (instead of passing the shared pointer with a
null-value inside).

Change-Id: I462e3d22aa4e1cc51e710c75ae0f9399c151240b
Reviewed-by: Ulf Hermann's avatarUlf Hermann <ulf.hermann@qt.io>
Reviewed-by: Nikolai Kosjar's avatarNikolai Kosjar <nikolai.kosjar@qt.io>
parent a3bdafcb
......@@ -31,6 +31,7 @@
#include <cplusplus/TypeOfExpression.h>
#include <cplusplus/cppmodelmanagerbase.h>
#include <cplusplus/CppDocument.h>
#include <utils/qtcassert.h>
#include <QList>
......@@ -819,6 +820,8 @@ FindExportedCppTypes::FindExportedCppTypes(const CPlusPlus::Snapshot &snapshot)
QStringList FindExportedCppTypes::operator()(const CPlusPlus::Document::Ptr &document)
{
QTC_ASSERT(!document.isNull(), return QStringList());
m_contextProperties.clear();
m_exportedTypes.clear();
QStringList fileNames;
......
......@@ -1321,7 +1321,10 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
if (!scan) {
hasNewInfo = newData.remove(fileName) > 0 || hasNewInfo;
foreach (const QString &file, newDeclarations[fileName]) {
finder(snapshot.document(file));
CPlusPlus::Document::Ptr doc = snapshot.document(file);
if (doc.isNull())
continue;
finder(doc);
hasNewInfo = rescanExports(file, finder, newData) || hasNewInfo;
}
continue;
......
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