diff --git a/Elf2Mac/Object.cc b/Elf2Mac/Object.cc index f765133260..a8c5a4ad5b 100644 --- a/Elf2Mac/Object.cc +++ b/Elf2Mac/Object.cc @@ -97,8 +97,8 @@ Object::Object(string input) if(boost::algorithm::starts_with(name,".rela.")) { string progbitsName = name.substr(5); - assert(sections.find(progbitsName) != sections.end()); - sections[progbitsName]->SetRela(scn); + if(sections.find(progbitsName) != sections.end()) + sections[progbitsName]->SetRela(scn); } } if(shdr.sh_type == SHT_PROGBITS && (shdr.sh_flags & SHF_ALLOC)) diff --git a/Elf2Mac/Symbol.cc b/Elf2Mac/Symbol.cc index ada272472a..0302b77b52 100644 --- a/Elf2Mac/Symbol.cc +++ b/Elf2Mac/Symbol.cc @@ -36,7 +36,8 @@ Symbol::Symbol(Object& theObject, const GElf_Sym &sym) if(st_shndx != SHN_UNDEF && st_shndx < SHN_LORESERVE) { section = theObject.sectionsByElfIndex[st_shndx]; - sectionKind = section->kind; + if (section) + sectionKind = section->kind; } if(st_name) {