1
0
Fork 0
forked from suyu/suyu

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.
This commit is contained in:
Lioncash 2018-07-22 02:54:07 -04:00
parent 398444e676
commit 0081252d31

View file

@ -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: