mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:07:35 +00: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 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:
|
private:
|
||||||
Vector<Match> m_matches;
|
Vector<Match> m_matches;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue