From 9c3824e81dfa2b355c5fb9498b42805bfa29a26f Mon Sep 17 00:00:00 2001 From: Kallum Jones Date: Thu, 4 Aug 2022 16:19:57 +0100 Subject: [PATCH] Protect against log file being null or undefined --- src/mod-manager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod-manager.ts b/src/mod-manager.ts index e8b5fd7..cc3d2a0 100644 --- a/src/mod-manager.ts +++ b/src/mod-manager.ts @@ -61,7 +61,7 @@ export default class ModManager { // If no errors are logged, cleanup the log file when the process exits process.on("exit", () => { // If file is only whitespace, i.e. blank - if (!readFileSync(this.LOG_FILE, "utf-8").trim().length) { + if (!readFileSync(this.LOG_FILE, "utf-8")?.trim().length) { unlinkSync(this.LOG_FILE) } })