From 0dc8e7f5bc82f5911d0b30f2bab8ad21eb2e4285 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 18 Apr 2018 19:23:10 +0200 Subject: [PATCH] Fixes #32568: A ResolvedKeybinding must have a first part --- .../platform/keybinding/common/usLayoutResolvedKeybinding.ts | 3 +-- .../services/keybinding/common/macLinuxKeyboardMapper.ts | 3 +++ .../services/keybinding/common/windowsKeyboardMapper.ts | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts b/src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts index 78861625e1a0c..a0c923e80784a 100644 --- a/src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts +++ b/src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts @@ -21,8 +21,7 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding { super(); this._os = OS; if (actual === null) { - this._firstPart = null; - this._chordPart = null; + throw new Error(`Invalid USLayoutResolvedKeybinding`); } else if (actual.type === KeybindingType.Chord) { this._firstPart = actual.firstPart; this._chordPart = actual.chordPart; diff --git a/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts b/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts index 2bb8da1d89024..1c56f4f0dde0d 100644 --- a/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts +++ b/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts @@ -74,6 +74,9 @@ export class NativeResolvedKeybinding extends ResolvedKeybinding { constructor(mapper: MacLinuxKeyboardMapper, OS: OperatingSystem, firstPart: ScanCodeBinding, chordPart: ScanCodeBinding) { super(); + if (!firstPart) { + throw new Error(`Invalid USLayoutResolvedKeybinding`); + } this._mapper = mapper; this._OS = OS; this._firstPart = firstPart; diff --git a/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts b/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts index 02c1dac816cc3..869932b1b18d1 100644 --- a/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts +++ b/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts @@ -86,6 +86,9 @@ export class WindowsNativeResolvedKeybinding extends ResolvedKeybinding { constructor(mapper: WindowsKeyboardMapper, firstPart: SimpleKeybinding, chordPart: SimpleKeybinding) { super(); + if (!firstPart) { + throw new Error(`Invalid WindowsNativeResolvedKeybinding firstPart`); + } this._mapper = mapper; this._firstPart = firstPart; this._chordPart = chordPart;