aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2022-03-22 11:13:27 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2022-03-22 11:01:18 +0000
commit137d3367cff2ca9e61d58599e1cf16bc5751589d (patch)
tree7226bb2450047a45df6ffd87b8266a3882a3020b
parent638b93591be0b1ddad4b342c85071d8ac7a8f1fb (diff)
CppEditor: Do not crash on doxygen comment creation
... for templates that were not parsed entirely successfully. Amends a437539096. Fixes: QTCREATORBUG-27207 Change-Id: I4d7935b30cac9ce14f442977d07417a343ecae11 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/cppeditor/doxygengenerator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/cppeditor/doxygengenerator.cpp b/src/plugins/cppeditor/doxygengenerator.cpp
index 9ab9e109eb..23d551afc8 100644
--- a/src/plugins/cppeditor/doxygengenerator.cpp
+++ b/src/plugins/cppeditor/doxygengenerator.cpp
@@ -141,8 +141,10 @@ QString DoxygenGenerator::generate(QTextCursor cursor,
QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl)
{
- if (const TemplateDeclarationAST * const templDecl = decl->asTemplateDeclaration())
+ if (const TemplateDeclarationAST * const templDecl = decl->asTemplateDeclaration();
+ templDecl && templDecl->declaration) {
decl = templDecl->declaration;
+ }
SpecifierAST *spec = nullptr;
DeclaratorAST *decltr = nullptr;