fix potential null pointer dereference for unnamed function arguments

This commit is contained in:
Robert Reif 2011-02-26 18:34:17 -05:00
parent 31a18b9b23
commit b74ebbda02
1 changed files with 12 additions and 2 deletions

View File

@ -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;
}
/**