From 137d3367cff2ca9e61d58599e1cf16bc5751589d Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 22 Mar 2022 11:13:27 +0100 Subject: [PATCH] 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 --- src/plugins/cppeditor/doxygengenerator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/cppeditor/doxygengenerator.cpp b/src/plugins/cppeditor/doxygengenerator.cpp index 9ab9e109eb6..23d551afc87 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;