mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibGUI/FileIconProvider: Return s_file_icon when stat() fails
Previously when using icon_for_path(), without specifying t_mode, on an anonymous file it would return an empty Icon causing problems down the line. Instead return the s_file_icon when stat fails.
This commit is contained in:
parent
bc174b0fd0
commit
5a8cc85328
Notes:
sideshowbarker
2024-07-18 16:56:50 +09:00
Author: https://github.com/metmo Commit: https://github.com/SerenityOS/serenity/commit/5a8cc853288 Pull-request: https://github.com/SerenityOS/serenity/pull/7730
1 changed files with 1 additions and 3 deletions
|
@ -122,7 +122,7 @@ Icon FileIconProvider::icon_for_path(const String& path)
|
|||
{
|
||||
struct stat stat;
|
||||
if (::stat(path.characters(), &stat) < 0)
|
||||
return {};
|
||||
return s_file_icon;
|
||||
return icon_for_path(path, stat.st_mode);
|
||||
}
|
||||
|
||||
|
@ -225,8 +225,6 @@ Icon FileIconProvider::icon_for_path(const String& path, mode_t mode)
|
|||
target_path = Core::File::real_path_for(String::formatted("{}/{}", LexicalPath(path).dirname(), raw_symlink_target));
|
||||
}
|
||||
auto target_icon = icon_for_path(target_path);
|
||||
if (target_icon.sizes().is_empty())
|
||||
return s_symlink_icon;
|
||||
|
||||
Icon generated_icon;
|
||||
for (auto size : target_icon.sizes()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue