From ce6bd6a7c372aabfbc0b9d8b4cae78d783020913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Sun, 2 Dec 2018 13:54:16 +0900 Subject: [PATCH] Fix #18 (#19) --- src/modules/server/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/server/index.ts b/src/modules/server/index.ts index f037e4b..59a6913 100644 --- a/src/modules/server/index.ts +++ b/src/modules/server/index.ts @@ -38,7 +38,7 @@ export default class ServerModule implements IModule { private check = () => { const average = (arr) => arr.reduce((a, b) => a + b) / arr.length; - const cpuPercentages = this.statsLogs.map(s => s.cpu_usage * 100); + const cpuPercentages = this.statsLogs.map(s => s && s.cpu_usage * 100 || 0); const cpuPercentage = average(cpuPercentages); if (cpuPercentage >= 70) { this.warn();