Переглянути джерело

vfs: Correct file_p variable usage within InterpretAsDirectory()

ReplaceFileWithSubdirectory() takes a VirtualFile and a VirtualDir, but
it was being passed a string as one of its arguments. The only reason
this never caused issues is because this template isn't instantiated
anywhere yet.

This corrects an issue before it occurs.
Lioncash 8 роки тому
батько
коміт
0081252d31
1 змінених файлів з 5 додано та 2 видалено
  1. 5 2
      src/core/file_sys/vfs.h

+ 5 - 2
src/core/file_sys/vfs.h

@@ -205,9 +205,12 @@ struct VfsDirectory : NonCopyable {
     template <typename Directory>
     template <typename Directory>
     bool InterpretAsDirectory(std::string_view file) {
     bool InterpretAsDirectory(std::string_view file) {
         auto file_p = GetFile(file);
         auto file_p = GetFile(file);
-        if (file_p == nullptr)
+
+        if (file_p == nullptr) {
             return false;
             return false;
-        return ReplaceFileWithSubdirectory(file, std::make_shared<Directory>(file_p));
+        }
+
+        return ReplaceFileWithSubdirectory(file_p, std::make_shared<Directory>(file_p));
     }
     }
 
 
 protected:
 protected: