diff --git a/DevTools/HackStudio/FindInFilesWidget.cpp b/DevTools/HackStudio/FindInFilesWidget.cpp index fe3717adb9..8491379013 100644 --- a/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/DevTools/HackStudio/FindInFilesWidget.cpp @@ -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 m_matches;