Crash on launch when viewing temperature of laptop HDD in sleep mode #824

This commit is contained in:
nicolargo 2016-03-27 18:46:11 +02:00
parent edb9eedf32
commit cef35eb23d
2 changed files with 6 additions and 2 deletions

4
NEWS
View File

@ -5,7 +5,9 @@ Glances Version 2
Version 2.7
===========
* ...
Bugs corrected:
* Crash on launch when viewing temperature of laptop HDD in sleep mode (issue #824)
Version 2.6.1
=============

View File

@ -21,6 +21,7 @@
import os
import socket
import numbers
from glances.compat import nativestr, range
from glances.logger import logger
@ -119,7 +120,8 @@ class GlancesGrabHDDTemp(object):
temperature = fields[offset + 3]
unit = nativestr(fields[offset + 4])
hddtemp_current['label'] = device
hddtemp_current['value'] = float(temperature) if temperature != b'ERR' else temperature
# Temperature could be 'ERR' or 'SLP' (see issue#824)
hddtemp_current['value'] = float(temperature) if isinstance(temperature, numbers.Number) else temperature
hddtemp_current['unit'] = unit
self.hddtemp_list.append(hddtemp_current)