From d018cfd5cb4aad0101c321fe2fcf9b21598e9590 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <qtc-committer@nokia.com>
Date: Mon, 9 Feb 2009 20:34:54 +0100
Subject: [PATCH] Fixes: Possible crash when completing a function with (void)
 argument.

---
 src/plugins/cpptools/cppcodecompletion.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp
index 9a4720702c4..8988fe12367 100644
--- a/src/plugins/cpptools/cppcodecompletion.cpp
+++ b/src/plugins/cpptools/cppcodecompletion.cpp
@@ -1113,7 +1113,8 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
                     toInsert.append(QLatin1Char('('));
 
                     // If the function takes no arguments, automatically place the closing parenthesis
-                    if (function->argumentCount() == 0 || (function->argumentCount() == 1 &&
+                    if (function->argumentCount() == 0 || (function->argumentCount() == 1  &&
+                                                           function->argumentAt(0)->type() &&
                                                            function->argumentAt(0)->type()->isVoidType())) {
                         toInsert.append(QLatin1Char(')'));
 
-- 
GitLab