diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp index 732d40bd604..f2e0f552180 100644 --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp @@ -370,7 +370,10 @@ static bool isAliasDecl(const Decl *TheDecl, const VarDecl *IndexVar) { case Stmt::CXXMemberCallExprClass: { const auto *MemCall = cast<CXXMemberCallExpr>(Init); - if (MemCall->getMethodDecl()->getName() == "at") { + // This check is needed because getMethodDecl can return nullptr if the + // callee is a member function pointer. + if (MemCall->getMethodDecl() && + MemCall->getMethodDecl()->getName() == "at") { assert(MemCall->getNumArgs() == 1); return isIndexInSubscriptExpr(MemCall->getArg(0), IndexVar); } |