From 7b012b207b1c104c9bbb1ec1cfc42721d6416e4b Mon Sep 17 00:00:00 2001
From: Gabor Horvath <xazax.hun@gmail.com>
Date: Mon, 26 Oct 2015 13:32:26 +0000
Subject: [PATCH] [analyzer] Fixed a rare crash when analyzing lambda
 functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251289 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/StaticAnalyzer/Core/MemRegion.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/StaticAnalyzer/Core/MemRegion.cpp b/lib/StaticAnalyzer/Core/MemRegion.cpp
index d41fed0619e..86e33969d21 100644
--- a/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ b/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -1022,7 +1022,7 @@ MemRegionManager::getCXXThisRegion(QualType thisPointerTy,
   // 'this' refers to a this to the enclosing scope, there is no right region to
   // return.
   while (!LC->inTopFrame() &&
-         PT != D->getThisType(getContext())->getAs<PointerType>()) {
+         (!D || PT != D->getThisType(getContext())->getAs<PointerType>())) {
     LC = LC->getParent();
     D = dyn_cast<CXXMethodDecl>(LC->getDecl());
   }
-- 
GitLab