diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index 21901343510..259c8c1f914 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -529,6 +529,7 @@ "./vs/platform/url/common/urlService.ts", "./vs/platform/url/electron-main/electronUrlListener.ts", "./vs/platform/url/node/urlIpc.ts", + "./vs/platform/widget/browser/contextScopedHistoryWidget.ts", "./vs/platform/widget/common/contextScopedWidget.ts", "./vs/platform/windows/common/windows.ts", "./vs/platform/windows/electron-browser/windowService.ts", diff --git a/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts b/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts index b1ad5c47ea9..f75f0b4d7dd 100644 --- a/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts +++ b/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts @@ -57,8 +57,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ primary: KeyCode.UpArrow, secondary: [KeyMod.Alt | KeyCode.UpArrow], handler: (accessor, arg2) => { - const historyInputBox: IHistoryNavigationWidget = getContextScopedWidget(accessor.get(IContextKeyService), HistoryNavigationWidgetContext).historyNavigator; - historyInputBox.showPreviousValue(); + const widget = getContextScopedWidget(accessor.get(IContextKeyService), HistoryNavigationWidgetContext); + if (widget) { + const historyInputBox: IHistoryNavigationWidget = widget.historyNavigator; + historyInputBox.showPreviousValue(); + } } }); @@ -69,7 +72,10 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ primary: KeyCode.DownArrow, secondary: [KeyMod.Alt | KeyCode.DownArrow], handler: (accessor, arg2) => { - const historyInputBox: IHistoryNavigationWidget = getContextScopedWidget(accessor.get(IContextKeyService), HistoryNavigationWidgetContext).historyNavigator; - historyInputBox.showNextValue(); + const widget = getContextScopedWidget(accessor.get(IContextKeyService), HistoryNavigationWidgetContext); + if (widget) { + const historyInputBox: IHistoryNavigationWidget = widget.historyNavigator; + historyInputBox.showNextValue(); + } } });