From 5736fa3351f3efc9b8ec068643afe6057488f1c7 Mon Sep 17 00:00:00 2001 From: Eladash Date: Thu, 16 Sep 2021 12:50:30 +0300 Subject: [PATCH] Fix Emulator::IsPathInsideDir --- rpcs3/Emu/System.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 0e1461216c..215fe64bdd 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1903,7 +1903,9 @@ std::set Emulator::GetGameDirs() const bool Emulator::IsPathInsideDir(std::string_view path, std::string_view dir) const { - return (GetCallbacks().resolve_path(path) + '/').starts_with(GetCallbacks().resolve_path(dir) + '/'); + const std::string dir_path = GetCallbacks().resolve_path(dir); + + return !dir_path.empty() && (GetCallbacks().resolve_path(path) + '/').starts_with(dir_path + '/'); }; const std::string& Emulator::GetFakeCat() const