REFACTOR: Invert 'if' statement to reduce nesting.

This commit is contained in:
2017-12-21 06:06:19 +00:00
parent 9cd1869d1d
commit 4d886dae25
138 changed files with 9447 additions and 9806 deletions

View File

@@ -43,19 +43,20 @@ namespace DiscImageChef.Devices
/// </summary>
~Device()
{
if(fd != null)
switch(platformId)
{
case Interop.PlatformID.Win32NT:
Windows.Extern.CloseHandle((SafeFileHandle)fd);
break;
case Interop.PlatformID.Linux:
Linux.Extern.close((int)fd);
break;
case Interop.PlatformID.FreeBSD:
FreeBSD.Extern.cam_close_device((IntPtr)fd);
break;
}
if(fd == null) return;
switch(platformId)
{
case Interop.PlatformID.Win32NT:
Windows.Extern.CloseHandle((SafeFileHandle)fd);
break;
case Interop.PlatformID.Linux:
Linux.Extern.close((int)fd);
break;
case Interop.PlatformID.FreeBSD:
FreeBSD.Extern.cam_close_device((IntPtr)fd);
break;
}
}
}
}