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

Commit

Permalink
🔒 Add edge-case memleak safeguard (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
GitSquared committed Nov 20, 2018
1 parent ce27916 commit 0f51c41
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/classes/cpuinfo.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ class Cpuinfo {
updateCPUload() {
this.si.currentLoad((data) => {
let average = [[], []];

if (!data.cpus) return; // Prevent memleak in rare case where systeminformation takes extra time to retrieve CPU info (see github issue #216)

data.cpus.forEach((e, i) => {
this.series[i].append(new Date().getTime(), e.load);

Expand Down

0 comments on commit 0f51c41

Please sign in to comment.