From 60fa4205d38f7d5e8e707e3364aa782c9bf0c9b8 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Thu, 20 Jul 2023 14:40:27 -0700
Subject: [PATCH] Handle sensors without warning property
---
src/components/widgets/glances/glances.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/widgets/glances/glances.jsx b/src/components/widgets/glances/glances.jsx
index 6a65df18f..cf5806309 100644
--- a/src/components/widgets/glances/glances.jsx
+++ b/src/components/widgets/glances/glances.jsx
@@ -37,7 +37,7 @@ export default function Widget({ options }) {
{ options.cputemp && }
{ options.disk && !Array.isArray(options.disk) && }
- { options.disk && Array.isArray(options.disk) && options.disk.map((disk) => )}
+ { options.disk && Array.isArray(options.disk) && options.disk.map((disk) => ) }
{ options.uptime && }
{ options.label && }
;
@@ -50,7 +50,7 @@ export default function Widget({ options }) {
if (options.cputemp && cpuSensors) {
try {
mainTemp = cpuSensors.reduce((acc, s) => acc + s.value, 0) / cpuSensors.length;
- maxTemp = Math.max(cpuSensors.reduce((acc, s) => acc + s.warning, 0) / cpuSensors.length, maxTemp);
+ maxTemp = Math.max(cpuSensors.reduce((acc, s) => acc + (s.warning > 0 ? s.warning : 0), 0) / cpuSensors.length, maxTemp);
if (unit === "fahrenheit") {
mainTemp = convertToFahrenheit(mainTemp);
maxTemp = convertToFahrenheit(maxTemp);