From 0dda5eb6ef320e16d8e49fd1da5798d28ca6f819 Mon Sep 17 00:00:00 2001 From: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:52:24 +0300 Subject: [PATCH] fs: Fix nullptr check in GetFile --- src/core/file_sys/fs.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/fs.cpp b/src/core/file_sys/fs.cpp index f2fda657..c6bdf7ad 100644 --- a/src/core/file_sys/fs.cpp +++ b/src/core/file_sys/fs.cpp @@ -132,8 +132,12 @@ File* HandleTable::GetFile(int d) { } File* HandleTable::GetFile(const std::filesystem::path& host_name) { - const auto it = std::ranges::find(m_files, host_name, &File::m_host_name); - return it == m_files.end() ? nullptr : *it; + for (auto* file : m_files) { + if (file != nullptr && file->m_host_name == host_name) { + return file; + } + } + return nullptr; } } // namespace Core::FileSys