Skip to content

Commit fd085da

Browse files
author
Benjamin Pasero
committed
fix NPE for last edit location
1 parent 8b72d24 commit fd085da

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • src/vs/workbench/services/history/electron-browser

src/vs/workbench/services/history/electron-browser/history.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,15 @@ export class HistoryService extends Disposable implements IHistoryService {
210210
// Use a debouncer to make sure to capture the correct cursor position
211211
// after the model content has changed.
212212
this.activeEditorListeners.push(debounceEvent(activeTextEditorWidget.onDidChangeModelContent, (last, event) => event, 0)((event => {
213-
const position = activeTextEditorWidget.getPosition();
213+
this.lastEditLocation = { input: activeEditor };
214214

215-
this.lastEditLocation = {
216-
input: activeEditor,
217-
selection: {
215+
const position = activeTextEditorWidget.getPosition();
216+
if (position) {
217+
this.lastEditLocation.selection = {
218218
startLineNumber: position.lineNumber,
219219
startColumn: position.column
220-
}
221-
};
220+
};
221+
}
222222
})));
223223
}
224224
}

0 commit comments

Comments
 (0)