From 57915384c82403fb1ef94f0460561d1a8e68b961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Sun, 9 Jun 2013 20:11:20 +0000 Subject: [PATCH] Added code to handle exceptions when creating the report for drives that are no longer available/ready. --- Hardware/HDD/AbstractHarddrive.cs | 14 +++++++++----- Properties/AssemblyVersion.cs | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Hardware/HDD/AbstractHarddrive.cs b/Hardware/HDD/AbstractHarddrive.cs index 0873071..3bcefb8 100644 --- a/Hardware/HDD/AbstractHarddrive.cs +++ b/Hardware/HDD/AbstractHarddrive.cs @@ -317,11 +317,15 @@ namespace OpenHardwareMonitor.Hardware.HDD { } foreach (DriveInfo di in driveInfos) { - r.AppendLine("Logical drive name: " + di.Name); - r.AppendLine("Format: " + di.DriveFormat); - r.AppendLine("Total size: " + di.TotalSize); - r.AppendLine("Total free space: " + di.TotalFreeSpace); - r.AppendLine(); + if (!di.IsReady) + continue; + try { + r.AppendLine("Logical drive name: " + di.Name); + r.AppendLine("Format: " + di.DriveFormat); + r.AppendLine("Total size: " + di.TotalSize); + r.AppendLine("Total free space: " + di.TotalFreeSpace); + r.AppendLine(); + } catch (IOException) { } catch (UnauthorizedAccessException) { } } return r.ToString(); diff --git a/Properties/AssemblyVersion.cs b/Properties/AssemblyVersion.cs index 94ebd84..66e34a5 100644 --- a/Properties/AssemblyVersion.cs +++ b/Properties/AssemblyVersion.cs @@ -10,5 +10,5 @@ using System.Reflection; -[assembly: AssemblyVersion("0.5.1.15")] -[assembly: AssemblyInformationalVersion("0.5.1.15 Alpha")] \ No newline at end of file +[assembly: AssemblyVersion("0.5.1.16")] +[assembly: AssemblyInformationalVersion("0.5.1.16 Alpha")] \ No newline at end of file