From 5be85fa619e983248fe6891afd33d921ccb42af4 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 13 Nov 2017 11:17:06 +0100 Subject: [PATCH] Uncaught TypeError: Cannot read property 'toString' of null (fixes #38191) --- src/vs/base/node/extfs.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/vs/base/node/extfs.ts b/src/vs/base/node/extfs.ts index b17a41aa17d..c41a1992540 100644 --- a/src/vs/base/node/extfs.ts +++ b/src/vs/base/node/extfs.ts @@ -454,11 +454,14 @@ function normalizePath(path: string): string { export function watch(path: string, onChange: (type: string, path: string) => void): fs.FSWatcher { const watcher = fs.watch(path); watcher.on('change', (type, raw) => { - let file = raw.toString(); - if (platform.isMacintosh) { - // Mac: uses NFD unicode form on disk, but we want NFC - // See also https://github.com/nodejs/node/issues/2165 - file = strings.normalizeNFC(file); + let file: string = null; + if (raw) { // https://github.com/Microsoft/vscode/issues/38191 + file = raw.toString(); + if (platform.isMacintosh) { + // Mac: uses NFD unicode form on disk, but we want NFC + // See also https://github.com/nodejs/node/issues/2165 + file = strings.normalizeNFC(file); + } } onChange(type, file); -- GitLab