diff options
author | Maurice Hieronymus <maurice_hieronymus@yahoo.de> | 2021-07-11 18:28:16 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-18 13:13:31 +0200 |
commit | a205633643a828557c34e19d234a8c996c1f4ee3 (patch) | |
tree | 61dd405fc3a4d394b22baecd8405eb0abe8cc1af /Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp | |
parent | ae8472f9ca1b9f79497f1bc511aac4818ef3d79b (diff) | |
download | serenity-a205633643a828557c34e19d234a8c996c1f4ee3.zip |
HackStudio: Prevent crash when stepping through a program
The backtrace view expects that there is always a valid selection. This
is not true when we execute a step in the debugger. Therefore we need
to check if we have a valid selection in the on_selection_change
handler.
Diffstat (limited to 'Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp')
-rw-r--r-- | Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp index e626ff8a2a..f1842d7894 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp @@ -67,8 +67,12 @@ DebugInfoWidget::DebugInfoWidget() m_backtrace_view->on_selection_change = [this] { const auto& index = m_backtrace_view->selection().first(); - auto& model = static_cast<BacktraceModel&>(*m_backtrace_view->model()); + if (!index.is_valid()) { + return; + } + + auto& model = static_cast<BacktraceModel&>(*m_backtrace_view->model()); // Note: The reconstruction of the register set here is obviously incomplete. // We currently only reconstruct eip & ebp. Ideally would also reconstruct the other registers somehow. // (Other registers may be needed to get the values of variables who are not stored on the stack) |