mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
HackStudio: Don't vend invalid indices from SearchResultsModel
This fixes an assertion when clicking in the "find in files" search results table when there were no matches.
This commit is contained in:
parent
ebbae015ef
commit
e9280cba13
1 changed files with 8 additions and 1 deletions
|
@ -96,7 +96,14 @@ public:
|
|||
}
|
||||
|
||||
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_matches.at(row)); }
|
||||
virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override
|
||||
{
|
||||
if (row < 0 || row >= (int)m_matches.size())
|
||||
return {};
|
||||
if (column < 0 || column >= Column::__Count)
|
||||
return {};
|
||||
return create_index(row, column, &m_matches.at(row));
|
||||
}
|
||||
|
||||
private:
|
||||
Vector<Match> m_matches;
|
||||
|
|
Loading…
Add table
Reference in a new issue