diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h index 440bf9a8dccf..23dac87e979f 100644 --- a/lldb/include/lldb/Core/Address.h +++ b/lldb/include/lldb/Core/Address.h @@ -131,9 +131,11 @@ public: /// The offset in bytes into \a section. //------------------------------------------------------------------ Address (const lldb::SectionSP §ion_sp, lldb::addr_t offset) : - m_section_wp (section_sp), + m_section_wp (), // Don't init with section_sp in case section_sp is invalid (the weak_ptr will throw) m_offset (offset) { + if (section_sp) + m_section_wp = section_sp; } //------------------------------------------------------------------