forked from qt-creator/qt-creator
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 <ulf.hermann@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
committed by
Nikolai Kosjar
parent
a3bdafcbc8
commit
b47b9ea951
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user