Skip to content

Commit 8d3a399

Browse files
committed
Strict null work for watermark
1 parent c533c84 commit 8d3a399

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/vs/base/browser/ui/keybindingLabel/keybindingLabel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface KeybindingLabelOptions {
3333
export class KeybindingLabel {
3434

3535
private domNode: HTMLElement;
36-
private keybinding: ResolvedKeybinding;
36+
private keybinding: ResolvedKeybinding | undefined;
3737
private matches: Matches | undefined;
3838
private didEverRender: boolean;
3939

@@ -47,7 +47,7 @@ export class KeybindingLabel {
4747
return this.domNode;
4848
}
4949

50-
set(keybinding: ResolvedKeybinding, matches?: Matches) {
50+
set(keybinding: ResolvedKeybinding | undefined, matches?: Matches) {
5151
if (this.didEverRender && this.keybinding === keybinding && KeybindingLabel.areSame(this.matches, matches)) {
5252
return;
5353
}

src/vs/workbench/contrib/watermark/electron-browser/watermark.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ export class WatermarkContribution implements IWorkbenchContribution {
146146

147147
private create(): void {
148148
const container = this.partService.getContainer(Parts.EDITOR_PART);
149+
if (!container) {
150+
throw new Error('Could not find container');
151+
}
149152
container.classList.add('has-watermark');
150153

151154
this.watermark = $('.watermark');
@@ -176,7 +179,10 @@ export class WatermarkContribution implements IWorkbenchContribution {
176179
private destroy(): void {
177180
if (this.watermark) {
178181
this.watermark.remove();
179-
this.partService.getContainer(Parts.EDITOR_PART).classList.remove('has-watermark');
182+
const container = this.partService.getContainer(Parts.EDITOR_PART);
183+
if (container) {
184+
container.classList.remove('has-watermark');
185+
}
180186
this.dispose();
181187
}
182188
}

0 commit comments

Comments
 (0)