CppTools: Always check for a valid BuiltinEditorDocumentParser*

This fixes a crash if the include hierarchy sidebar is invoked with the
clang code model. BuiltinEditorDocumentParser::get(editorFilePath)
returns 0 in that case.

Task-number: QTCREATORBUG-13553
Change-Id: I9292691c8156bdaaffcac1c3864201ba8a6cbdef
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2014-11-28 11:29:00 +01:00
parent 2fc4acbc35
commit 488bf91797
4 changed files with 17 additions and 7 deletions

View File

@@ -143,7 +143,7 @@ void CppToolsPlugin::test_cppsourceprocessor_includes_cyclic()
// Check editor snapshot
const QString filePath = editor->document()->filePath();
BuiltinEditorDocumentParser *parser = BuiltinEditorDocumentParser::get(filePath);
auto *parser = BuiltinEditorDocumentParser::get(filePath);
QVERIFY(parser);
Snapshot snapshot = parser->snapshot();
QCOMPARE(snapshot.size(), 3); // Configuration file included