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.
This commit is contained in:
Kemal Zebari 2024-02-08 21:43:33 -08:00 committed by Andreas Kling
parent 2de9ffa632
commit 111e4162d0
Notes: sideshowbarker 2024-07-17 07:35:03 +09:00

View File

@ -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];