1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:55:08 +00:00

ProfileViewer: Don't crash when we can't disassemble something

This commit is contained in:
Andreas Kling 2020-04-11 23:15:33 +02:00
parent 8daddcfa0a
commit dccfff8c19

View file

@ -55,9 +55,15 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
, m_node(node)
{
m_file = make<MappedFile>(profile.executable_path());
if (!m_file->is_valid())
return;
auto elf_loader = make<ELF::Loader>((const u8*)m_file->data(), m_file->size());
auto symbol = elf_loader->find_symbol(node.address());
if (!symbol.has_value())
return;
ASSERT(symbol.has_value());
auto view = symbol.value().raw_data();