If string field is empty then return NULL.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85630 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2009-10-30 22:52:47 +00:00
parent dac8bde235
commit 5e8e2d7ad9

View File

@ -84,8 +84,11 @@ DIDescriptor::getStringField(unsigned Elt) const {
return NULL; return NULL;
if (Elt < DbgNode->getNumElements()) if (Elt < DbgNode->getNumElements())
if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getElement(Elt))) if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getElement(Elt))) {
if (MDS->getLength() == 0)
return NULL;
return MDS->getString().data(); return MDS->getString().data();
}
return NULL; return NULL;
} }