diff options
-rw-r--r-- | lldb/source/Symbol/Variable.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp index 47f573dd742..29fe4bbd262 100644 --- a/lldb/source/Symbol/Variable.cpp +++ b/lldb/source/Symbol/Variable.cpp @@ -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; } |