From 55ae3a7dbdff1332449d9b7917c05a6d1bc893b1 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Fri, 15 Mar 2024 11:15:23 +0800 Subject: [PATCH] CPU (FreeBSD): don't display 0.00 GHz --- src/detection/cpu/cpu_bsd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/detection/cpu/cpu_bsd.c b/src/detection/cpu/cpu_bsd.c index e1d647cd3..70623cbff 100644 --- a/src/detection/cpu/cpu_bsd.c +++ b/src/detection/cpu/cpu_bsd.c @@ -11,7 +11,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) cpu->coresLogical = cpu->coresPhysical; cpu->coresOnline = cpu->coresPhysical; - cpu->frequencyBase = ffSysctlGetInt("hw.clockrate", 0) / 1000.0; + int clockRate = ffSysctlGetInt("hw.clockrate", 0); + cpu->frequencyBase = clockRate <= 0 ? 0.0/0.0 : clockRate / 1000.0; cpu->temperature = FF_CPU_TEMP_UNSET; if (options->temp)