mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
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:
parent
2de9ffa632
commit
111e4162d0
Notes:
sideshowbarker
2024-07-17 07:35:03 +09:00
Author: https://github.com/kemzeb
Commit: 111e4162d0
Pull-request: https://github.com/SerenityOS/serenity/pull/23131
Reviewed-by: https://github.com/tcl3
1 changed files with 1 additions and 0 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue