[analyzer] Add a safety check to InnerPointerChecker.

Do not crash if the CXXRecordDecl of an object is not available.

llvm-svn: 338775
This commit is contained in:
Reka Kovacs 2018-08-02 22:19:57 +00:00
parent d91a9e27a9
commit 7d36e92c9c
1 changed files with 5 additions and 2 deletions

View File

@ -129,8 +129,11 @@ bool InnerPointerChecker::isCalledOnStringObject(
return false;
QualType ObjTy = ObjRegion->getValueType();
if (ObjTy.isNull() ||
ObjTy->getAsCXXRecordDecl()->getName() != "basic_string")
if (ObjTy.isNull())
return false;
CXXRecordDecl *Decl = ObjTy->getAsCXXRecordDecl();
if (!Decl || Decl->getName() != "basic_string")
return false;
return true;