summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsa <sa@0x2a.wtf>2022-03-05 16:34:24 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-06 01:36:41 +0100
commitfd628cdfec7e4bfcb6d169b732cde5b1e83eb7b4 (patch)
tree41465d03ecbd6a44d9132c1394cf14479af1cccb
parentd5aed70dcf3cf19d53106d7d511d64d9bc180562 (diff)
downloadserenity-fd628cdfec7e4bfcb6d169b732cde5b1e83eb7b4.zip
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.
-rw-r--r--Userland/Applications/Browser/CookiesModel.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Applications/Browser/CookiesModel.cpp b/Userland/Applications/Browser/CookiesModel.cpp
index 7cf100578e..5768e17f34 100644
--- a/Userland/Applications/Browser/CookiesModel.cpp
+++ b/Userland/Applications/Browser/CookiesModel.cpp
@@ -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