From 9bfc7d98608f01b02cd0fcbbcc9c0c9d42e9f245 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 9 Feb 2021 20:58:17 +0000 Subject: [PATCH] Fixed tests --- packages/lib/models/settings/FileHandler.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/lib/models/settings/FileHandler.ts b/packages/lib/models/settings/FileHandler.ts index dd7bd08c5f..7f6601354f 100644 --- a/packages/lib/models/settings/FileHandler.ts +++ b/packages/lib/models/settings/FileHandler.ts @@ -16,12 +16,12 @@ export default class FileHandler { } public async load(): Promise { - if (this.valueJsonCache_) return JSON.parse(this.valueJsonCache_); - - if (!(await shim.fsDriver().exists(this.filePath_))) { - this.valueJsonCache_ = '{}'; - } else { - this.valueJsonCache_ = await shim.fsDriver().readFile(this.filePath_, 'utf8'); + if (!this.valueJsonCache_) { + if (!(await shim.fsDriver().exists(this.filePath_))) { + this.valueJsonCache_ = '{}'; + } else { + this.valueJsonCache_ = await shim.fsDriver().readFile(this.filePath_, 'utf8'); + } } try {