From 2fa6f196d65c18ad47595aff186faffb009f62c1 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 17 Nov 2015 22:39:26 +0000 Subject: [PATCH] Fix null dereference committed in r253277 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253393 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARF/DWARFUnit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/DebugInfo/DWARF/DWARFUnit.cpp b/lib/DebugInfo/DWARF/DWARFUnit.cpp index 53a149b1b23..92ca2d4c3ff 100644 --- a/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -38,8 +38,9 @@ DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section, const DWARFUnitIndex::Entry *IndexEntry) : Context(DC), InfoSection(Section), Abbrev(DA), RangeSection(RS), LineSection(LS), StringSection(SS), StringOffsetSection([&]() { - if (const auto *C = IndexEntry->getOffset(DW_SECT_STR_OFFSETS)) - return SOS.slice(C->Offset, C->Offset + C->Length); + if (IndexEntry) + if (const auto *C = IndexEntry->getOffset(DW_SECT_STR_OFFSETS)) + return SOS.slice(C->Offset, C->Offset + C->Length); return SOS; }()), AddrOffsetSection(AOS), isLittleEndian(LE), UnitSection(UnitSection), -- 2.34.1