diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index c1dc1e0ddb274e779c3a0b44d5e1103361a0e406..9a4720702c4b2ed101a4dbf2d05b655bc038c8db 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -1119,7 +1119,8 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) // If the function doesn't return anything, automatically place the semicolon, // unless we're doing a scope completion (then it might be function definition). - if (function->returnType()->isVoidType() && m_completionOperator != T_COLON_COLON) { + FullySpecifiedType retTy = function->returnType(); + if (retTy && retTy->isVoidType() && m_completionOperator != T_COLON_COLON) { toInsert.append(QLatin1Char(';')); } }