summaryrefslogtreecommitdiff
path: root/Userland/DevTools
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-05-27 11:43:06 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-27 11:45:29 +0200
commit2952c86f3859b579bdf53d1eb57c33775710d64b (patch)
treedddd8f740904358e456da4439d7e006108a5986c /Userland/DevTools
parent2ec302ea22157c2be037430a5c27f82f19b4efd9 (diff)
downloadserenity-2952c86f3859b579bdf53d1eb57c33775710d64b.zip
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.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r--Userland/DevTools/Profiler/Profile.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp
index d48e18f6aa..2c5a9b65a3 100644
--- a/Userland/DevTools/Profiler/Profile.cpp
+++ b/Userland/DevTools/Profiler/Profile.cpp
@@ -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()