Commit 5cc33788 authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppEditor: Fix crash in InsertQtPropertyMembers for invalid code

Change-Id: I8a3a3240033d23aa9e3df5276c4e6302d97f71b9
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@theqtcompany.com>
parent 9f272bcb
......@@ -1467,6 +1467,11 @@ void CppEditorPlugin::test_quickfix_data()
" }\n"
" f1(*str);\n"
"}\n");
QTest::newRow("InsertQtPropertyMembers_noTriggerInvalidCode")
<< CppQuickFixFactoryPtr(new InsertQtPropertyMembers)
<< _("class C { @Q_PROPERTY(typeid foo READ foo) };\n")
<< _();
}
void CppEditorPlugin::test_quickfix()
......
......@@ -4254,7 +4254,7 @@ void InsertQtPropertyMembers::match(const CppQuickFixInterface &interface,
AST * const ast = path.last();
QtPropertyDeclarationAST *qtPropertyDeclaration = ast->asQtPropertyDeclaration();
if (!qtPropertyDeclaration)
if (!qtPropertyDeclaration || !qtPropertyDeclaration->type_id)
return;
ClassSpecifierAST *klass = 0;
......
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