summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorMarco Rebhan <me@dblsaiko.net>2022-04-01 15:00:46 +0200
committerAndreas Kling <kling@serenityos.org>2022-04-14 23:44:09 +0200
commita4639fced91d74a9532e68fe9014a876ff0bfef1 (patch)
tree92dde467e0f7f996e13065bf0634fcd4130814a8 /Userland
parent7c91fda088dd92907e64d38af1093db6e693f641 (diff)
downloadserenity-a4639fced91d74a9532e68fe9014a876ff0bfef1.zip
LibGUI: Don't try to get link target value if read_link failed
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/FileSystemModel.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp
index 964e025026..db273ab797 100644
--- a/Userland/Libraries/LibGUI/FileSystemModel.cpp
+++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp
@@ -64,10 +64,11 @@ bool FileSystemModel::Node::fetch_data(String const& full_path, bool is_root)
auto sym_link_target_or_error = Core::File::read_link(full_path);
if (sym_link_target_or_error.is_error())
perror("readlink");
-
- symlink_target = sym_link_target_or_error.release_value();
- if (symlink_target.is_null())
- perror("readlink");
+ else {
+ symlink_target = sym_link_target_or_error.release_value();
+ if (symlink_target.is_null())
+ perror("readlink");
+ }
}
if (S_ISDIR(mode)) {