X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FFileUtils.ts;h=5c15734bfe97cbf7857b3199f53ece7114ff1368;hb=2c3872a1a3b3b5da128500bbfb65ece46a29fc3d;hp=cab28941e730f831ed58f3639863ecfa97767bfd;hpb=a95873d8d308a20a7151346ac70d9a551f1a06f5;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/FileUtils.ts b/src/utils/FileUtils.ts index cab28941..5c15734b 100644 --- a/src/utils/FileUtils.ts +++ b/src/utils/FileUtils.ts @@ -18,7 +18,7 @@ export default class FileUtils { if (filename && event === 'change') { try { logger.debug(logPrefix + ' ' + fileType + ' file ' + file + ' have changed, reload'); - attribute = JSON.parse(fs.readFileSync(file, 'utf8')) as T; + attribute && (attribute = JSON.parse(fs.readFileSync(file, 'utf8')) as T); } catch (error) { FileUtils.handleFileException(logPrefix, fileType, file, error as NodeJS.ErrnoException, { throwError: false,