mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
HackStudio: Don't crash when navigating backtrace with up/down keys
It's up to BacktraceModel::index() to validate its inputs.
This commit is contained in:
parent
575b674081
commit
18ff75e67b
2 changed files with 8 additions and 1 deletions
|
@ -41,6 +41,13 @@ GUI::Variant BacktraceModel::data(const GUI::ModelIndex& index, Role role) const
|
|||
return {};
|
||||
}
|
||||
|
||||
GUI::ModelIndex BacktraceModel::index(int row, int column, const GUI::ModelIndex&) const
|
||||
{
|
||||
if (row < 0 || row >= static_cast<int>(m_frames.size()))
|
||||
return {};
|
||||
return create_index(row, column, &m_frames.at(row));
|
||||
}
|
||||
|
||||
Vector<BacktraceModel::FrameInfo> BacktraceModel::create_backtrace(const DebugSession& debug_session, const PtraceRegisters& regs)
|
||||
{
|
||||
u32 current_ebp = regs.ebp;
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
virtual GUI::Variant data(const GUI::ModelIndex& index, Role role = Role::Display) const override;
|
||||
|
||||
virtual void update() override {}
|
||||
virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override { return create_index(row, column, &m_frames.at(row)); }
|
||||
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override;
|
||||
|
||||
struct FrameInfo {
|
||||
String function_name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue