mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 01:27:31 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user