From b74ebbda02e9f03e4f46909c31d903b86ef5a245 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Sat, 26 Feb 2011 18:34:17 -0500 Subject: [PATCH] fix potential null pointer dereference for unnamed function arguments --- lib/symboldatabase.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 8f6cdbc63..e55d018de 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -125,7 +125,13 @@ public: */ const std::string &name() const { - return _name->str(); + static const std::string noname; + + // name may not exist for function arguments + if (_name) + return _name->str(); + + return noname; } /** @@ -134,7 +140,11 @@ public: */ unsigned int varId() const { - return _name->varId(); + // name may not exist for function arguments + if (_name) + return _name->varId(); + + return 0; } /**