diff --git a/BizHawk.Common/Extensions/PathExtensions.cs b/BizHawk.Common/Extensions/PathExtensions.cs index 1d4fcbbb2a..df105f3939 100644 --- a/BizHawk.Common/Extensions/PathExtensions.cs +++ b/BizHawk.Common/Extensions/PathExtensions.cs @@ -78,6 +78,7 @@ namespace BizHawk.Common.PathExtensions // zero 06-nov-2015 - regarding the below, i changed my mind. for libretro i want subdirectories here. var filesystemDir = Path.GetDirectoryName(filesystemSafeName); + if (string.IsNullOrEmpty(filesystemDir)) throw new Exception(); filesystemSafeName = Path.GetFileName(filesystemSafeName); filesystemSafeName = filesystemSafeName.RemoveInvalidFileSystemChars(); @@ -114,7 +115,8 @@ namespace BizHawk.Common.PathExtensions { public static string GetExeDirectoryAbsolute() { - var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); + var path = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location); + if (string.IsNullOrEmpty(path)) throw new Exception(); if (path.EndsWith(Path.DirectorySeparatorChar.ToString())) { path = path.Remove(path.Length - 1, 1);