diff --git a/lib/Windows/VolumeInfoCache.cs b/lib/Windows/VolumeInfoCache.cs index 06aff76..c4125c8 100644 --- a/lib/Windows/VolumeInfoCache.cs +++ b/lib/Windows/VolumeInfoCache.cs @@ -151,12 +151,12 @@ public VolumeInfo GetVolumeForPath(string path) out ulong _); if (!result) { + int lastErr = Marshal.GetLastWin32Error(); if (lastErr == NativeMethods.ERROR_DEV_NOT_EXIST) { return null; } - int lastErr = Marshal.GetLastWin32Error(); NativeMethods.ThrowSpecificIoException(lastErr, $"Failed retrieving drive volume cluster layout information for {volumePaths.PrimaryDriveRootPath} with winerror {lastErr}"); }