mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-26 04:35:41 +03: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: https://github.com/SerenityOS/serenity/commit/111e4162d0 Pull-request: https://github.com/SerenityOS/serenity/pull/23131 Reviewed-by: https://github.com/tcl3
@ -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…
Reference in New Issue
Block a user