Skip to content

Commit dfe053f

Browse files
committed
check if the pattern is not null in hasPattern
1 parent 81c4221 commit dfe053f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4605,7 +4605,8 @@ AST_MATCHER_P(CXXFoldExpr, hasFoldInit, ast_matchers::internal::Matcher<Expr>,
46054605
/// \endcode
46064606
AST_MATCHER_P(CXXFoldExpr, hasPattern, ast_matchers::internal::Matcher<Expr>,
46074607
InnerMacher) {
4608-
return InnerMacher.matches(*Node.getPattern(), Finder, Builder);
4608+
const Expr *const Pattern = Node.getPattern();
4609+
return Pattern && InnerMacher.matches(*Pattern, Finder, Builder);
46094610
}
46104611

46114612
/// Matches right-folding fold expressions.

0 commit comments

Comments
 (0)