forked from qt-creator/qt-creator
CppEditor: Fix crash in InsertQtPropertyMembers for invalid code
Change-Id: I8a3a3240033d23aa9e3df5276c4e6302d97f71b9 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
@@ -1467,6 +1467,11 @@ void CppEditorPlugin::test_quickfix_data()
|
|||||||
" }\n"
|
" }\n"
|
||||||
" f1(*str);\n"
|
" f1(*str);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
|
QTest::newRow("InsertQtPropertyMembers_noTriggerInvalidCode")
|
||||||
|
<< CppQuickFixFactoryPtr(new InsertQtPropertyMembers)
|
||||||
|
<< _("class C { @Q_PROPERTY(typeid foo READ foo) };\n")
|
||||||
|
<< _();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppEditorPlugin::test_quickfix()
|
void CppEditorPlugin::test_quickfix()
|
||||||
|
|||||||
@@ -4254,7 +4254,7 @@ void InsertQtPropertyMembers::match(const CppQuickFixInterface &interface,
|
|||||||
|
|
||||||
AST * const ast = path.last();
|
AST * const ast = path.last();
|
||||||
QtPropertyDeclarationAST *qtPropertyDeclaration = ast->asQtPropertyDeclaration();
|
QtPropertyDeclarationAST *qtPropertyDeclaration = ast->asQtPropertyDeclaration();
|
||||||
if (!qtPropertyDeclaration)
|
if (!qtPropertyDeclaration || !qtPropertyDeclaration->type_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ClassSpecifierAST *klass = 0;
|
ClassSpecifierAST *klass = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user