From 34ef809aeedc6b6ea86472ea07e11edc8680f5c3 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Fri, 11 Aug 2017 19:16:58 +0300 Subject: [PATCH] handle null results from winreg (fixes #174) --- terminus-terminal/src/shells/cygwin32.ts | 2 +- terminus-terminal/src/shells/cygwin64.ts | 2 +- terminus-terminal/src/shells/gitBash.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/terminus-terminal/src/shells/cygwin32.ts b/terminus-terminal/src/shells/cygwin32.ts index 4d9fb095..3c0ce996 100644 --- a/terminus-terminal/src/shells/cygwin32.ts +++ b/terminus-terminal/src/shells/cygwin32.ts @@ -25,7 +25,7 @@ export class Cygwin32ShellProvider extends ShellProvider { let cygwinPath = await new Promise(resolve => { let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup', arch: 'x86' }) reg.get('rootdir', (err, item) => { - if (err) { + if (err || !item) { return resolve(null) } resolve(item.value) diff --git a/terminus-terminal/src/shells/cygwin64.ts b/terminus-terminal/src/shells/cygwin64.ts index 85db2ae9..2d3f73cb 100644 --- a/terminus-terminal/src/shells/cygwin64.ts +++ b/terminus-terminal/src/shells/cygwin64.ts @@ -25,7 +25,7 @@ export class Cygwin64ShellProvider extends ShellProvider { let cygwinPath = await new Promise(resolve => { let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup', arch: 'x64' }) reg.get('rootdir', (err, item) => { - if (err) { + if (err || !item) { return resolve(null) } resolve(item.value) diff --git a/terminus-terminal/src/shells/gitBash.ts b/terminus-terminal/src/shells/gitBash.ts index cfdecc38..68e12eae 100644 --- a/terminus-terminal/src/shells/gitBash.ts +++ b/terminus-terminal/src/shells/gitBash.ts @@ -25,7 +25,7 @@ export class GitBashShellProvider extends ShellProvider { let gitBashPath = await new Promise(resolve => { let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\GitForWindows' }) reg.get('InstallPath', (err, item) => { - if (err) { + if (err || !item) { resolve(null) return }