1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:57:46 +00:00

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

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