From 111e4162d0e073fa0dd43812b4da57534c8d7a01 Mon Sep 17 00:00:00 2001 From: Kemal Zebari Date: Thu, 8 Feb 2024 21:43:33 -0800 Subject: [PATCH] LibGUI/Application: Resize recent files list to max open file size Since it's possible to have the actual recently opened files < max_recently_open_files(), which causes us to crash when we try to access new_recent_files_list where index >= the list's size. --- Userland/Libraries/LibGUI/Application.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index df85bc4ae5..d0006b8ca8 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -388,6 +388,7 @@ void Application::set_most_recently_open_file(ByteString new_path) }); new_recent_files_list.prepend(new_path); + new_recent_files_list.resize(max_recently_open_files()); for (size_t i = 0; i < max_recently_open_files(); ++i) { auto& path = new_recent_files_list[i];