Fixed Variable::GetDecl() and Variable::GetDeclContext() to check the "Type *" before...
authorGreg Clayton <gclayton@apple.com>
Tue, 12 Apr 2016 00:06:27 +0000 (00:06 +0000)
committerGreg Clayton <gclayton@apple.com>
Tue, 12 Apr 2016 00:06:27 +0000 (00:06 +0000)
<rdar://problem/25612626>

llvm-svn: 266023

lldb/source/Symbol/Variable.cpp

index 47f573d..29fe4bb 100644 (file)
@@ -244,16 +244,22 @@ CompilerDeclContext
 Variable::GetDeclContext ()
 {
     Type *type = GetType();
-    return type->GetSymbolFile()->GetDeclContextContainingUID(GetID());
+    if (type)
+        return type->GetSymbolFile()->GetDeclContextContainingUID(GetID());
+    return CompilerDeclContext();
 }
 
 CompilerDecl
 Variable::GetDecl ()
 {
+    CompilerDecl decl;
     Type *type = GetType();
-    CompilerDecl decl = type->GetSymbolFile()->GetDeclForUID(GetID());
-    if (decl)
-        decl.GetTypeSystem()->DeclLinkToObject(decl.GetOpaqueDecl(), shared_from_this());
+    if (type)
+    {
+        decl = type->GetSymbolFile()->GetDeclForUID(GetID());
+        if (decl)
+            decl.GetTypeSystem()->DeclLinkToObject(decl.GetOpaqueDecl(), shared_from_this());
+    }
     return decl;
 }