Skip to content

Commit

Permalink
protect against bad results, #11455
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Sep 19, 2016
1 parent 0c4759a commit ec8f8da
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/vs/workbench/api/node/mainThreadLanguageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
this._registrations[handle] = WorkspaceSymbolProviderRegistry.register(<IWorkspaceSymbolProvider>{
provideWorkspaceSymbols: (search: string): TPromise<IWorkspaceSymbol[]> => {
return this._proxy.$provideWorkspaceSymbols(handle, search).then(result => {
for (const item of result) {
trackGarbageCollection(item, ObjectIdentifier.get(item));
if (result) {
for (const item of result) {
trackGarbageCollection(item, ObjectIdentifier.get(item));
}
}
return result;
});
Expand Down Expand Up @@ -187,8 +189,10 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
triggerCharacters: triggerCharacters,
provideCompletionItems: (model:IReadOnlyModel, position:EditorPosition, token:CancellationToken): Thenable<modes.ISuggestResult> => {
return wireCancellationToken(token, this._proxy.$provideCompletionItems(handle, model.uri, position)).then(result => {
for (const suggestion of result.suggestions) {
trackGarbageCollection(suggestion, ObjectIdentifier.get(suggestion));
if (result && result.suggestions) {
for (const suggestion of result.suggestions) {
trackGarbageCollection(suggestion, ObjectIdentifier.get(suggestion));
}
}
return result;
});
Expand Down

0 comments on commit ec8f8da

Please sign in to comment.