Profiler: Don't try to create a DisassemblyModel for invalid indices

This fixes a null dereference when toggling the "top functions" mode
while a top-level process node was selected.
This commit is contained in:
Andreas Kling 2021-05-27 11:43:06 +02:00
parent 2ec302ea22
commit 2952c86f38
Notes: sideshowbarker 2024-07-18 17:20:19 +09:00

View file

@ -465,7 +465,10 @@ void Profile::set_disassembly_index(const GUI::ModelIndex& index)
return;
m_disassembly_index = index;
auto* node = static_cast<ProfileNode*>(index.internal_data());
m_disassembly_model = DisassemblyModel::create(*this, *node);
if (!node)
m_disassembly_model = nullptr;
else
m_disassembly_model = DisassemblyModel::create(*this, *node);
}
GUI::Model* Profile::disassembly_model()