From a4639fced91d74a9532e68fe9014a876ff0bfef1 Mon Sep 17 00:00:00 2001 From: Marco Rebhan Date: Fri, 1 Apr 2022 15:00:46 +0200 Subject: [PATCH] LibGUI: Don't try to get link target value if read_link failed --- Userland/Libraries/LibGUI/FileSystemModel.cpp | 9 +++++---- 1 file 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)) {