From: David Blaikie Date: Tue, 17 Nov 2015 22:39:26 +0000 (+0000) Subject: Fix null dereference committed in r253277 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2fa6f196d65c18ad47595aff186faffb009f62c1;p=oota-llvm.git Fix null dereference committed in r253277 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253393 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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),