Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit edc2531

Browse files
committed
fix: check cpu info size
1 parent c9f15a2 commit edc2531

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

engine/utils/hardware/cpu_info.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
namespace cortex::hw {
1212
inline CPU GetCPUInfo() {
13-
auto cpu = hwinfo::getAllCPUs()[0];
13+
auto res = hwinfo::getAllCPUs();
14+
if (res.empty())
15+
return CPU{};
16+
auto cpu = res[0];
1417
cortex::cpuid::CpuInfo inst;
1518
return CPU{.cores = cpu.numPhysicalCores(),
1619
.arch = std::string(GetArch()),

0 commit comments

Comments
 (0)