From 9333af20f5933e5f6e276e053b568f61e7e44fe0 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 29 Mar 2023 14:57:31 -0700 Subject: [PATCH] Update glances.jsx --- src/components/widgets/glances/glances.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/widgets/glances/glances.jsx b/src/components/widgets/glances/glances.jsx index d91cb2633..b0acdaa0a 100644 --- a/src/components/widgets/glances/glances.jsx +++ b/src/components/widgets/glances/glances.jsx @@ -65,7 +65,10 @@ export default function Widget({ options }) { } const unit = options.units === "imperial" ? "fahrenheit" : "celsius"; - const mainTemp = (options.cputemp && data.sensors && unit === "celsius") ? data.sensors.find(s => s.label.includes("cpu_thermal")).value : data.sensors.find(s => s.label.includes("cpu_thermal")).value * 5/9 + 32; + let mainTemp; + if (options.cputemp && data.sensors) { + mainTemp = unit === "celsius" ? data.sensors.find(s => s.label.includes("cpu_thermal")).value : data.sensors.find(s => s.label.includes("cpu_thermal")).value * 5/9 + 32; + } return (
@@ -104,7 +107,7 @@ export default function Widget({ options }) {
- {options.cputemp && + {options.cputemp && mainTemp && (