From 46839e09e71765e0a7cfe414a2d50f3652524d63 Mon Sep 17 00:00:00 2001 From: PipoCanaja Date: Sat, 16 Mar 2019 18:06:09 +0100 Subject: [PATCH] Do not use $sensor[sensor_limit] if not available --- html/includes/graphs/sensor/humidity.inc.php | 4 +++- html/includes/graphs/sensor/temperature.inc.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/html/includes/graphs/sensor/humidity.inc.php b/html/includes/graphs/sensor/humidity.inc.php index f6781ff218..e953385f38 100644 --- a/html/includes/graphs/sensor/humidity.inc.php +++ b/html/includes/graphs/sensor/humidity.inc.php @@ -10,7 +10,9 @@ $rrd_options .= " COMMENT:' Last Max\\n'"; $rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE"; $rrd_options .= " DEF:sensor_max=$rrd_filename:sensor:MAX"; $rrd_options .= " DEF:sensor_min=$rrd_filename:sensor:MIN"; -$rrd_options .= ' CDEF:sensorwarm=sensor_max,'.$sensor['sensor_limit'].',GT,sensor,UNKN,IF'; +if (is_numeric($sensor['sensor_limit'])) { + $rrd_options .= ' CDEF:sensorwarm=sensor_max,'.$sensor['sensor_limit'].',GT,sensor,UNKN,IF'; +} $rrd_options .= ' CDEF:sensorcold=sensor_min,20,LT,sensor,UNKN,IF'; $rrd_options .= ' AREA:sensor_max#c5c5c5'; $rrd_options .= ' AREA:sensor_min#ffffffff'; diff --git a/html/includes/graphs/sensor/temperature.inc.php b/html/includes/graphs/sensor/temperature.inc.php index 4f3ddac072..94008d76cf 100644 --- a/html/includes/graphs/sensor/temperature.inc.php +++ b/html/includes/graphs/sensor/temperature.inc.php @@ -9,7 +9,9 @@ $rrd_options .= " COMMENT:' Min Last Max\\n'"; $rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE"; $rrd_options .= " DEF:sensor_max=$rrd_filename:sensor:MAX"; $rrd_options .= " DEF:sensor_min=$rrd_filename:sensor:MIN"; -$rrd_options .= ' CDEF:sensorwarm=sensor_max,'.$sensor['sensor_limit'].',GT,sensor,UNKN,IF'; +if (is_numeric($sensor['sensor_limit'])) { + $rrd_options .= ' CDEF:sensorwarm=sensor_max,'.$sensor['sensor_limit'].',GT,sensor,UNKN,IF'; +} $rrd_options .= ' CDEF:sensorcold=sensor_min,20,LT,sensor,UNKN,IF'; $rrd_options .= ' CDEF:sensor_diff=sensor_max,sensor_min,-'; $rrd_options .= ' AREA:sensor_min';