瀏覽代碼

vfs_real: require file existence on open

Liam 3 年之前
父節點
當前提交
ed7c4af915
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/core/file_sys/vfs_real.cpp

+ 4 - 0
src/core/file_sys/vfs_real.cpp

@@ -81,6 +81,10 @@ VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) {
         }
     }
 
+    if (!FS::Exists(path) || !FS::IsFile(path)) {
+        return nullptr;
+    }
+
     auto reference = std::make_unique<FileReference>();
     this->InsertReferenceIntoList(*reference);