diff --git a/src/plugins/cppeditor/cppchecksymbols.cpp b/src/plugins/cppeditor/cppchecksymbols.cpp
index b7b95d8b930c7d7cce42d6635d0f319b770d73b2..e105cf48b43a50f4fd5b5fbe6e1639e0de12745b 100644
--- a/src/plugins/cppeditor/cppchecksymbols.cpp
+++ b/src/plugins/cppeditor/cppchecksymbols.cpp
@@ -662,7 +662,7 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast)
 
     accept(ast->decl_specifier_list);
 
-    if (ast->declarator && ! ast->symbol->isGenerated()) {
+    if (ast->declarator && ast->symbol && ! ast->symbol->isGenerated()) {
         Function *fun = ast->symbol;
         if (NameAST *declId = declaratorId(ast->declarator)) {
             if (QualifiedNameAST *q = declId->asQualifiedName())