Make Value::getNameLen not crash on an empty name, fixing PR1712.

llvm-svn: 42444
This commit is contained in:
Chris Lattner 2007-09-28 20:09:40 +00:00
parent 2fca1e4f84
commit 14442c9a4d

View File

@ -128,7 +128,7 @@ const char *Value::getNameStart() const {
/// getNameLen - Return the length of the string, correctly handling nul
/// characters embedded into them.
unsigned Value::getNameLen() const {
return Name->getKeyLength();
return Name ? Name->getKeyLength() : 0;
}