From c7943dc624365767d5efe76e06f4a02232e98de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Sun, 15 May 2011 16:00:22 +0000 Subject: [PATCH] Fixed Issue 217. --- GUI/SensorNotifyIcon.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GUI/SensorNotifyIcon.cs b/GUI/SensorNotifyIcon.cs index b98e4ac..63eac10 100644 --- a/GUI/SensorNotifyIcon.cs +++ b/GUI/SensorNotifyIcon.cs @@ -176,6 +176,9 @@ namespace OpenHardwareMonitor.GUI { } private string GetString() { + if (!sensor.Value.HasValue) + return "-"; + switch (sensor.SensorType) { case SensorType.Voltage: return string.Format("{0:F11}", sensor.Value); @@ -237,7 +240,8 @@ namespace OpenHardwareMonitor.GUI { graphics.Clear(Color.Black); } graphics.FillRectangle(darkBrush, 0.5f, -0.5f, bitmap.Width - 2, bitmap.Height); - float y = 0.16f * (100 - sensor.Value.Value); + float value = sensor.Value.GetValueOrDefault(); + float y = 0.16f * (100 - value); graphics.FillRectangle(brush, 0.5f, -0.5f + y, bitmap.Width - 2, bitmap.Height - y); graphics.DrawRectangle(pen, 1, 0, bitmap.Width - 3, bitmap.Height - 1);