diff --git a/Rdmp.Core/ReusableLibraryCode/UsefulStuff.cs b/Rdmp.Core/ReusableLibraryCode/UsefulStuff.cs index cd94ca9ab4..37aa7303b0 100644 --- a/Rdmp.Core/ReusableLibraryCode/UsefulStuff.cs +++ b/Rdmp.Core/ReusableLibraryCode/UsefulStuff.cs @@ -46,7 +46,7 @@ public static bool IsBasicallyNull(this string result) public static bool IsBadName(string name) { - return name != null && name.Any(c => Path.GetInvalidFileNameChars().Contains(c)); + return name?.Any(Path.GetInvalidFileNameChars().Contains) == true; } public static void OpenUrl(string url) @@ -206,9 +206,7 @@ private static char GetCHICheckDigit(string sCHI) public static DirectoryInfo GetExecutableDirectory() { - return !string.IsNullOrWhiteSpace(AppDomain.CurrentDomain.BaseDirectory) - ? new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory) - : new DirectoryInfo(typeof(UsefulStuff).Assembly.Location); + return new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory ?? throw new Exception("BaseDirectory was null?!")); } public static string HashFile(string filename, int retryCount = 6)