fix crash in cppunitassertequals plugin

Change-Id: I0427c70aa3a7f55aba4bbe0fe571aab08596541a
Reviewed-on: https://gerrit.libreoffice.org/22922
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
Markus Mohrhard 2016-03-05 05:31:04 +01:00
parent 42032f5d3b
commit a3d8833bd8

View File

@ -76,19 +76,19 @@ void CppunitAssertEquals::checkExpr(const Stmt* stmt)
return;
}
parent = parentStmt(parent);
if (!isa<UnaryOperator>(parent)) {
if (!parent || !isa<UnaryOperator>(parent)) {
return;
}
parent = parentStmt(parent);
if (!isa<CallExpr>(parent)) {
if (!parent || !isa<CallExpr>(parent)) {
return;
}
const CallExpr* callExpr = dyn_cast<CallExpr>(parent);
if (callExpr->getDirectCallee() == nullptr) {
if (!callExpr || callExpr->getDirectCallee() == nullptr) {
return;
}
const FunctionDecl* functionDecl = callExpr->getDirectCallee()->getCanonicalDecl();
if (functionDecl->getQualifiedNameAsString().find("Asserter::failIf") == std::string::npos) {
if (!functionDecl || functionDecl->getQualifiedNameAsString().find("Asserter::failIf") == std::string::npos) {
return;
}
report(