From fd628cdfec7e4bfcb6d169b732cde5b1e83eb7b4 Mon Sep 17 00:00:00 2001 From: sa Date: Sat, 5 Mar 2022 16:34:24 +0100 Subject: [PATCH] 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. --- Userland/Applications/Browser/CookiesModel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(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