From 3ad0181169dc8efcdec7166a76a4624d73bdad48 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 21 Jul 2020 12:11:52 +0200 Subject: [PATCH] [clangd] Fix null check after D82739. I hit the null-deference crash when opening ASTReaderDecl.cpp. The BaseType can be a nullptr, --- clang-tools-extra/clangd/FindTarget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp index bc4002c..c6022b2 100644 --- a/clang-tools-extra/clangd/FindTarget.cpp +++ b/clang-tools-extra/clangd/FindTarget.cpp @@ -175,6 +175,8 @@ std::vector resolveDependentExprToDecls(const Expr *E) { if (ME->isArrow()) { BaseType = getPointeeType(BaseType); } + if (!BaseType) + return {}; if (const auto *BT = BaseType->getAs()) { // If BaseType is the type of a dependent expression, it's just // represented as BultinType::Dependent which gives us no information. We -- 2.7.4