From 0081252d317af44b3e810d7f31fdd3fb03b8e23c Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Sun, 22 Jul 2018 02:54:07 -0400
Subject: [PATCH] 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.
---
 src/core/file_sys/vfs.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h
index 529c6c952..4a13b8378 100644
--- a/src/core/file_sys/vfs.h
+++ b/src/core/file_sys/vfs.h
@@ -205,9 +205,12 @@ struct VfsDirectory : NonCopyable {
     template <typename Directory>
     bool InterpretAsDirectory(std::string_view file) {
         auto file_p = GetFile(file);
-        if (file_p == nullptr)
+
+        if (file_p == nullptr) {
             return false;
-        return ReplaceFileWithSubdirectory(file, std::make_shared<Directory>(file_p));
+        }
+
+        return ReplaceFileWithSubdirectory(file_p, std::make_shared<Directory>(file_p));
     }
 
 protected: