From 6b060f3dbf57fe5cbe6b857cde6c091854625456 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 27 Jan 2023 00:42:04 +0100 Subject: [PATCH] Fix nullish checks MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/utils/Configuration.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index e3daddf7..209ce774 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -373,7 +373,7 @@ export default class Configuration { private static getConfigurationFileWatcher(): fs.FSWatcher | undefined { try { return fs.watch(Configuration.configurationFile, (event, filename): void => { - if (filename.trim().length !== 0 && event === 'change') { + if (filename?.trim().length !== 0 && event === 'change') { // Nullify to force configuration file reading Configuration.configuration = null; if (!Configuration.isUndefined(Configuration.configurationChangeCallback)) { @@ -429,7 +429,7 @@ export default class Configuration { logPrefix: string, params: HandleErrorParams = { throwError: true } ): void { - const prefix = logPrefix.trim().length !== 0 ? `${logPrefix} ` : ''; + const prefix = logPrefix?.trim().length !== 0 ? `${logPrefix} ` : ''; let logMsg: string; switch (error.code) { case 'ENOENT': -- 2.34.1