mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
DisplaySettings: Don't crash after 'pape'
Running 'pape' without arguments (or just editing the WindowServer.ini by hand) can confuse DisplaySettings. Specifically, if the 'Wallpaper' is set to '/res/wallpapers/', then DisplaySettings used to crash because 'name_parts' wouldn't contain any trailing element. It's hard to define desired behavior, but this is better than crashing and confusing the user.
This commit is contained in:
parent
1b140d1b5b
commit
5d3ac4ec9e
Notes:
sideshowbarker
2024-07-19 07:03:04 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/5d3ac4ec9ee Pull-request: https://github.com/SerenityOS/serenity/pull/2036 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/zlotny
@ -275,7 +275,7 @@ void DisplaySettingsWidget::load_current_settings()
|
||||
|
||||
Optional<size_t> optional_index;
|
||||
if (selected_wallpaper.starts_with("/res/wallpapers/")) {
|
||||
auto name_parts = selected_wallpaper.split('/');
|
||||
auto name_parts = selected_wallpaper.split('/', true);
|
||||
optional_index = m_wallpapers.find_first_index(name_parts[2]);
|
||||
|
||||
if (optional_index.has_value()) {
|
||||
|
Loading…
Reference in New Issue
Block a user