From: Jérôme Benoit Date: Thu, 26 Jan 2023 23:42:04 +0000 (+0100) Subject: Fix nullish checks X-Git-Tag: v1.1.93~32 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6b060f3dbf57fe5cbe6b857cde6c091854625456;p=e-mobility-charging-stations-simulator.git Fix nullish checks Signed-off-by: Jérôme Benoit --- 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':