diff options
Diffstat (limited to 'compilerplugins/clang/unnecessaryparen.cxx')
-rw-r--r-- | compilerplugins/clang/unnecessaryparen.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compilerplugins/clang/unnecessaryparen.cxx b/compilerplugins/clang/unnecessaryparen.cxx index 11655d51389e..1d11aca4ab47 100644 --- a/compilerplugins/clang/unnecessaryparen.cxx +++ b/compilerplugins/clang/unnecessaryparen.cxx @@ -262,8 +262,10 @@ bool UnnecessaryParen::VisitParenExpr(const ParenExpr* parenExpr) bool UnnecessaryParen::VisitIfStmt(const IfStmt* ifStmt) { - handleUnreachableCodeConditionParens(ifStmt->getCond()); - VisitSomeStmt(ifStmt, ifStmt->getCond(), "if"); + if (auto const cond = ifStmt->getCond()) { + handleUnreachableCodeConditionParens(cond); + VisitSomeStmt(ifStmt, cond, "if"); + } return true; } |