From e4c1ef55cec60327e8e81e4df1b69dc473016578 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Mon, 22 Oct 2012 20:49:35 +0000 Subject: [PATCH] Fixed a crasher where if an invalid SBTarget was passed to: lldb::addr_t SBAddress::GetLoadAddress (const SBTarget &target) const; We would crash. llvm-svn: 166439 --- lldb/source/API/SBAddress.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp index 6013fd38cf27..f3e0d78b70aa 100644 --- a/lldb/source/API/SBAddress.cpp +++ b/lldb/source/API/SBAddress.cpp @@ -119,10 +119,13 @@ SBAddress::GetLoadAddress (const SBTarget &target) const lldb::addr_t addr = LLDB_INVALID_ADDRESS; TargetSP target_sp (target.GetSP()); - if (m_opaque_ap.get()) + if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); - addr = m_opaque_ap->GetLoadAddress (target_sp.get()); + if (m_opaque_ap.get()) + { + Mutex::Locker api_locker (target_sp->GetAPIMutex()); + addr = m_opaque_ap->GetLoadAddress (target_sp.get()); + } } if (log)