Browser: Fix crash in Storage Inspector when the cookie list is emtpy

This patch fixes a crash when clicking on an empty cookie list in the
Browsers Storage Inspector.
This commit is contained in:
sa 2022-03-05 16:34:24 +01:00 committed by Andreas Kling
parent d5aed70dcf
commit fd628cdfec
Notes: sideshowbarker 2024-07-19 17:07:40 +09:00

View File

@ -48,7 +48,9 @@ String CookiesModel::column_name(int column) const
GUI::ModelIndex CookiesModel::index(int row, int column, GUI::ModelIndex const&) const
{
return create_index(row, column, &m_cookies.at(row));
if (static_cast<size_t>(row) < m_cookies.size())
return create_index(row, column, &m_cookies.at(row));
return {};
}
GUI::Variant CookiesModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) const