From: Haojian Wu Date: Tue, 21 Jul 2020 10:11:52 +0000 (+0200) Subject: [clangd] Fix null check after D82739. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ad0181169dc8efcdec7166a76a4624d73bdad48;p=platform%2Fupstream%2Fllvm.git [clangd] Fix null check after D82739. I hit the null-deference crash when opening ASTReaderDecl.cpp. The BaseType can be a nullptr, --- 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