Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit 0f51c41

Browse files
committed
🔒 Add edge-case memleak safeguard (#216)
1 parent ce27916 commit 0f51c41

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/classes/cpuinfo.class.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ class Cpuinfo {
116116
updateCPUload() {
117117
this.si.currentLoad((data) => {
118118
let average = [[], []];
119+
120+
if (!data.cpus) return; // Prevent memleak in rare case where systeminformation takes extra time to retrieve CPU info (see github issue #216)
121+
119122
data.cpus.forEach((e, i) => {
120123
this.series[i].append(new Date().getTime(), e.load);
121124

0 commit comments

Comments
 (0)