From d3d08ae13611cd48da13ca98687c6ccc833a1420 Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Thu, 11 Jul 2024 00:43:27 +0200 Subject: [PATCH] Throw an exception instead of returning null for SwitchPathToSystemPath and GetFullPath --- src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs b/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs index 0827266a12..d98ba182f7 100644 --- a/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs +++ b/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs @@ -98,14 +98,14 @@ namespace Ryujinx.HLE.FileSystem } else { - return null; + throw new ArgumentException($"The filename does not start with '/': {fileName}", nameof(fileName)); } string fullPath = Path.GetFullPath(Path.Combine(basePath, fileName)); if (!fullPath.StartsWith(AppDataManager.BaseDirPath)) { - return null; + throw new ArgumentException($"The path is not located inside the Ryujinx directory: {fullPath}", nameof(basePath)); } return fullPath; @@ -120,7 +120,7 @@ namespace Ryujinx.HLE.FileSystem if (parts.Length != 2) { - return null; + throw new ArgumentException($"Invalid switch fs path provided: {switchPath}", nameof(switchPath)); } return GetFullPath(MakeFullPath(parts[0]), parts[1]);