Skip to content

Commit e5e2937

Browse files
committed
Remove extra conditional
1 parent 47e54ae commit e5e2937

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

src/vs/workbench/browser/editor.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,20 @@ class EditorRegistry implements IEditorRegistry {
109109
const matchingDescriptors: EditorDescriptor[] = [];
110110

111111
for (const editor of this.editors) {
112-
const inputDescriptors = this.mapEditorToInputs.get(editor);
113-
if (inputDescriptors) {
114-
for (const inputDescriptor of inputDescriptors) {
115-
const inputClass = inputDescriptor.ctor;
116-
117-
// Direct check on constructor type (ignores prototype chain)
118-
if (!byInstanceOf && input.constructor === inputClass) {
119-
matchingDescriptors.push(editor);
120-
break;
121-
}
122-
123-
// Normal instanceof check
124-
else if (byInstanceOf && input instanceof inputClass) {
125-
matchingDescriptors.push(editor);
126-
break;
127-
}
112+
const inputDescriptors = this.mapEditorToInputs.get(editor) || [];
113+
for (const inputDescriptor of inputDescriptors) {
114+
const inputClass = inputDescriptor.ctor;
115+
116+
// Direct check on constructor type (ignores prototype chain)
117+
if (!byInstanceOf && input.constructor === inputClass) {
118+
matchingDescriptors.push(editor);
119+
break;
120+
}
121+
122+
// Normal instanceof check
123+
else if (byInstanceOf && input instanceof inputClass) {
124+
matchingDescriptors.push(editor);
125+
break;
128126
}
129127
}
130128
}

0 commit comments

Comments
 (0)