Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low-hanging nullable fruit #5186

Merged
merged 19 commits into from
Apr 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Guard against possible undefined in LanguageMiddlewareFeature
  • Loading branch information
50Wliu committed Apr 24, 2022
commit 6eea46b15dc616d18d609482def4c4dae5080b11
7 changes: 4 additions & 3 deletions src/omnisharp/LanguageMiddlewareFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ type RemapParameterType<M extends keyof RemapApi> = GetRemapType<NonNullable<Rem

export class LanguageMiddlewareFeature implements IDisposable {
private readonly _middlewares: LanguageMiddleware[];
private _registration: IDisposable;
private _registration: IDisposable | undefined;

constructor() {
this._middlewares = [];
}

public dispose(): void {
this._registration.dispose();
// this._registration should always be defined, but just in case we never register...
this._registration?.dispose();
}

public register(): void {
Expand Down Expand Up @@ -69,4 +70,4 @@ export class LanguageMiddlewareFeature implements IDisposable {
return original;
}
}
}
}